mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 17:43:06 +02:00
Lint cleanup.
This commit is contained in:
@@ -83,9 +83,8 @@ public class TrackStubUtils {
|
||||
loc.setTime(INITIAL_TIME);
|
||||
loc.setBearing(INITIAL_BEARING);
|
||||
SensorDataSet sd = SensorDataSet.newBuilder().build();
|
||||
MyTracksLocation myTracksLocation = new MyTracksLocation(loc, sd);
|
||||
|
||||
return myTracksLocation;
|
||||
return new MyTracksLocation(loc, sd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -210,7 +210,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
// Id
|
||||
AndroidMock.expect(cursorMock.getLong(columnIndex++)).andReturn(trackId);
|
||||
// Name
|
||||
String name = NAME_PREFIX + Long.toString(trackId);
|
||||
String name = NAME_PREFIX + trackId;
|
||||
AndroidMock.expect(cursorMock.getString(columnIndex++)).andReturn(name);
|
||||
AndroidMock.replay(cursorMock);
|
||||
Track track = providerUtils.createTrack(cursorMock);
|
||||
@@ -416,7 +416,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
// Id
|
||||
AndroidMock.expect(cursorMock.getLong(columnIndex++)).andReturn(id);
|
||||
// Name
|
||||
String name = NAME_PREFIX + Long.toString(id);
|
||||
String name = NAME_PREFIX + id;
|
||||
AndroidMock.expect(cursorMock.getString(columnIndex++)).andReturn(name);
|
||||
// trackIdIndex
|
||||
long trackId = 11L;
|
||||
|
||||
+5
-6
@@ -153,12 +153,12 @@ public abstract class TrackWriterTest extends AndroidTestCase {
|
||||
assertTrue(length > 0);
|
||||
|
||||
// The children may be a sucession of text elements, just concatenate them
|
||||
String result = "";
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
Text textNode = (Text) children.item(i);
|
||||
result += textNode.getNodeValue();
|
||||
result.append(textNode.getNodeValue());
|
||||
}
|
||||
return result;
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,8 +212,7 @@ public abstract class TrackWriterTest extends AndroidTestCase {
|
||||
builderFactory.setIgnoringComments(true);
|
||||
builderFactory.setIgnoringElementContentWhitespace(true);
|
||||
DocumentBuilder documentBuilder = builderFactory.newDocumentBuilder();
|
||||
Document doc = documentBuilder.parse(
|
||||
new InputSource(new StringReader(contents)));
|
||||
return doc;
|
||||
|
||||
return documentBuilder.parse(new InputSource(new StringReader(contents)));
|
||||
}
|
||||
}
|
||||
|
||||
+16
-17
@@ -164,26 +164,25 @@ public class TrackRecordingServiceTest extends ServiceTestCase<TestRecordingServ
|
||||
@Override
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
|
||||
String sortOrder) {
|
||||
MockCursor mockCursor = new MockCursor() {
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 1;
|
||||
}
|
||||
return new MockCursor() {
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveToNext() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean moveToNext() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(int columnIndex) {
|
||||
return String.valueOf(GoogleLocationUtils.USE_LOCATION_FOR_SERVICES_ON);
|
||||
}
|
||||
@Override
|
||||
public String getString(int columnIndex) {
|
||||
return String.valueOf(GoogleLocationUtils.USE_LOCATION_FOR_SERVICES_ON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {}
|
||||
};
|
||||
return mockCursor;
|
||||
@Override
|
||||
public void close() {}
|
||||
};
|
||||
}
|
||||
};
|
||||
mockContentResolver.addProvider("com.google.settings", googleSettingsProvider);
|
||||
|
||||
+2
-2
@@ -165,7 +165,7 @@ public class StringUtilsTest extends AndroidTestCase {
|
||||
* Tests {@link StringUtils#getTimeParts(long)} with a positive number.
|
||||
*/
|
||||
public void testGetTimeParts_postive() {
|
||||
int parts[] = StringUtils.getTimeParts(61000);
|
||||
int[] parts = StringUtils.getTimeParts(61000);
|
||||
assertEquals(1, parts[0]);
|
||||
assertEquals(1, parts[1]);
|
||||
assertEquals(0, parts[2]);
|
||||
@@ -175,7 +175,7 @@ public class StringUtilsTest extends AndroidTestCase {
|
||||
* Tests {@link StringUtils#getTimeParts(long)} with a negative number.
|
||||
*/
|
||||
public void testGetTimeParts_negative() {
|
||||
int parts[] = StringUtils.getTimeParts(-61000);
|
||||
int[] parts = StringUtils.getTimeParts(-61000);
|
||||
assertEquals(-1, parts[0]);
|
||||
assertEquals(-1, parts[1]);
|
||||
assertEquals(0, parts[2]);
|
||||
|
||||
+5
-7
@@ -58,13 +58,11 @@ public abstract class AbstractSendToGoogleActivity extends AbstractMyTracksActiv
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case DELETE_REQUEST_CODE:
|
||||
onDeleted();
|
||||
break;
|
||||
default:
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
if (requestCode == DELETE_REQUEST_CODE) {
|
||||
onDeleted();
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void configureListViewContextualMenu(final Activity activity, final ListView listView,
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ public interface ContextualActionModeCallback {
|
||||
* @param ids the selected items' ids, if available
|
||||
* @param showSelectAll true to show select all
|
||||
*/
|
||||
public void onPrepare(Menu menu, int[] positions, long[] ids, boolean showSelectAll);
|
||||
void onPrepare(Menu menu, int[] positions, long[] ids, boolean showSelectAll);
|
||||
|
||||
/**
|
||||
* Invoked when items are selected.
|
||||
@@ -42,5 +42,5 @@ public interface ContextualActionModeCallback {
|
||||
* @param positions the selected items' positions
|
||||
* @param ids the selected items' ids, if available
|
||||
*/
|
||||
public boolean onClick(int itemId, int[] positions, long[] ids);
|
||||
boolean onClick(int itemId, int[] positions, long[] ids);
|
||||
}
|
||||
@@ -289,12 +289,10 @@ public class SearchListActivity extends AbstractSendToGoogleActivity implements
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.search_list_search:
|
||||
return false;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
if (item.getItemId() == R.id.search_list_search) {
|
||||
return false;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -204,8 +204,7 @@ public class TrackDetailActivity extends AbstractSendToGoogleActivity
|
||||
hasCamera = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA);
|
||||
photoUri = savedInstanceState != null ? (Uri) savedInstanceState.getParcelable(PHOTO_URI_KEY)
|
||||
: null;
|
||||
hasPhoto = savedInstanceState != null ? savedInstanceState.getBoolean(HAS_PHOTO_KEY, false)
|
||||
: false;
|
||||
hasPhoto = savedInstanceState != null && savedInstanceState.getBoolean(HAS_PHOTO_KEY, false);
|
||||
|
||||
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(this);
|
||||
handleIntent(getIntent());
|
||||
|
||||
@@ -215,8 +215,8 @@ public class TrackListActivity extends AbstractSendToGoogleActivity implements F
|
||||
@Override
|
||||
public boolean onClick(int itemId, int[] positions, long[] ids) {
|
||||
return handleContextItem(itemId, ids);
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
private final OnClickListener recordListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
@@ -563,7 +563,7 @@ public class TrackListActivity extends AbstractSendToGoogleActivity implements F
|
||||
// Hide trackController when search dialog is shown
|
||||
trackController.hide();
|
||||
return super.onSearchRequested();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TrackRecordingServiceConnection getTrackRecordingServiceConnection() {
|
||||
|
||||
+4
-4
@@ -27,22 +27,22 @@ public interface DataSourceListener {
|
||||
/**
|
||||
* Notifies when the tracks table is updated.
|
||||
*/
|
||||
public void notifyTracksTableUpdated();
|
||||
void notifyTracksTableUpdated();
|
||||
|
||||
/**
|
||||
* Notifies when the waypoints table is updated.
|
||||
*/
|
||||
public void notifyWaypointsTableUpdated();
|
||||
void notifyWaypointsTableUpdated();
|
||||
|
||||
/**
|
||||
* Notifies when the track points table is updated.
|
||||
*/
|
||||
public void notifyTrackPointsTableUpdated();
|
||||
void notifyTrackPointsTableUpdated();
|
||||
|
||||
/**
|
||||
* Notifies when a preference changes.
|
||||
*
|
||||
* @param key the preference key
|
||||
*/
|
||||
public void notifyPreferenceChanged(String key);
|
||||
void notifyPreferenceChanged(String key);
|
||||
}
|
||||
+16
-16
@@ -30,8 +30,8 @@ public interface TrackDataListener {
|
||||
*
|
||||
* @author Jimmy Shih
|
||||
*/
|
||||
public enum LocationState {
|
||||
DISABLED, NO_FIX, BAD_FIX, GOOD_FIX;
|
||||
enum LocationState {
|
||||
DISABLED, NO_FIX, BAD_FIX, GOOD_FIX
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,31 +39,31 @@ public interface TrackDataListener {
|
||||
*
|
||||
* @param track the track
|
||||
*/
|
||||
public void onTrackUpdated(Track track);
|
||||
void onTrackUpdated(Track track);
|
||||
|
||||
/**
|
||||
* Called to clear previously-sent track points.
|
||||
*/
|
||||
public void clearTrackPoints();
|
||||
void clearTrackPoints();
|
||||
|
||||
/**
|
||||
* Called when a sampled in track point is read.
|
||||
*
|
||||
* @param location the location
|
||||
*/
|
||||
public void onSampledInTrackPoint(Location location);
|
||||
void onSampledInTrackPoint(Location location);
|
||||
|
||||
/**
|
||||
* Called when a sampled out track point is read.
|
||||
*
|
||||
* @param location the location
|
||||
*/
|
||||
public void onSampledOutTrackPoint(Location location);
|
||||
void onSampledOutTrackPoint(Location location);
|
||||
|
||||
/**
|
||||
* Called when an invalid track point representing a segment split is read.
|
||||
*/
|
||||
public void onSegmentSplit(Location location);
|
||||
void onSegmentSplit(Location location);
|
||||
|
||||
/**
|
||||
* Called when finish sending new track points. This gets called after every
|
||||
@@ -71,26 +71,26 @@ public interface TrackDataListener {
|
||||
* {@link #onSampledOutTrackPoint(Location)} and
|
||||
* {@link #onSegmentSplit(Location)}.
|
||||
*/
|
||||
public void onNewTrackPointsDone();
|
||||
void onNewTrackPointsDone();
|
||||
|
||||
/**
|
||||
* Called to clear previously sent waypoints.
|
||||
*/
|
||||
public void clearWaypoints();
|
||||
void clearWaypoints();
|
||||
|
||||
/**
|
||||
* Called when a new waypoint is read.
|
||||
*
|
||||
* @param waypoint the waypoint
|
||||
*/
|
||||
public void onNewWaypoint(Waypoint waypoint);
|
||||
void onNewWaypoint(Waypoint waypoint);
|
||||
|
||||
/**
|
||||
* Called when finish sending new waypoints. This gets called after every
|
||||
* batch of calls to {@link #clearWaypoints()} and
|
||||
* {@link #onNewWaypoint(Waypoint)}.
|
||||
*/
|
||||
public void onNewWaypointsDone();
|
||||
void onNewWaypointsDone();
|
||||
|
||||
/**
|
||||
* Called when the metric units preference value is change.
|
||||
@@ -98,7 +98,7 @@ public interface TrackDataListener {
|
||||
* @param metricUnits true to use metric units, false to use imperial units
|
||||
* @return true to reload all the data, false otherwise.
|
||||
*/
|
||||
public boolean onMetricUnitsChanged(boolean metricUnits);
|
||||
boolean onMetricUnitsChanged(boolean metricUnits);
|
||||
|
||||
/**
|
||||
* Called when the report speed preference value is changed.
|
||||
@@ -106,7 +106,7 @@ public interface TrackDataListener {
|
||||
* @param reportSpeed true to report speed, false to report pace
|
||||
* @return true to reload all the data, false otherwise.
|
||||
*/
|
||||
public boolean onReportSpeedChanged(boolean reportSpeed);
|
||||
boolean onReportSpeedChanged(boolean reportSpeed);
|
||||
|
||||
/**
|
||||
* Called when the recording gps accuracy preference value is changed.
|
||||
@@ -114,7 +114,7 @@ public interface TrackDataListener {
|
||||
* @param recordingGpsAccuracy the new value
|
||||
* @return true to reload all the data, false otherwise
|
||||
*/
|
||||
public boolean onRecordingGpsAccuracy(int recordingGpsAccuracy);
|
||||
boolean onRecordingGpsAccuracy(int recordingGpsAccuracy);
|
||||
|
||||
/**
|
||||
* Called when the recording distance interval preference value is changed.
|
||||
@@ -122,7 +122,7 @@ public interface TrackDataListener {
|
||||
* @param recordingDistanceInterval the new value
|
||||
* @return true to reload all the data, false otherwise.
|
||||
*/
|
||||
public boolean onRecordingDistanceIntervalChanged(int recordingDistanceInterval);
|
||||
boolean onRecordingDistanceIntervalChanged(int recordingDistanceInterval);
|
||||
|
||||
/**
|
||||
* Called when the map type preference value is changed.
|
||||
@@ -130,5 +130,5 @@ public interface TrackDataListener {
|
||||
* @param mapType the new value
|
||||
* @return true to reload all the data, false otherwise.
|
||||
*/
|
||||
public boolean onMapTypeChanged(int mapType);
|
||||
boolean onMapTypeChanged(int mapType);
|
||||
}
|
||||
|
||||
+2
@@ -21,6 +21,7 @@ import com.google.android.apps.mytracks.util.DialogUtils;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
|
||||
/**
|
||||
@@ -30,6 +31,7 @@ import android.support.v4.app.DialogFragment;
|
||||
*/
|
||||
public abstract class AbstractMyTracksDialogFragment extends DialogFragment {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Dialog dialog = createDialog();
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
||||
* data on every onStart or onResume.
|
||||
*/
|
||||
chartView = new ChartView(getActivity());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
|
||||
+4
-2
@@ -28,6 +28,7 @@ import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.ShareCompat;
|
||||
import android.view.View;
|
||||
@@ -58,7 +59,7 @@ public class ChooseActivityDialogFragment extends AbstractMyTracksDialogFragment
|
||||
/**
|
||||
* Called when choose activity is done.
|
||||
*/
|
||||
public void onChooseActivityDone(String packageName, String className);
|
||||
void onChooseActivityDone(String packageName, String className);
|
||||
}
|
||||
|
||||
private static class ViewHolder {
|
||||
@@ -91,8 +92,9 @@ public class ChooseActivityDialogFragment extends AbstractMyTracksDialogFragment
|
||||
|
||||
ArrayAdapter<DisplayInfo> arrayAdapter = new ArrayAdapter<DisplayInfo>(fragmentActivity,
|
||||
R.layout.choose_activity_list_item, R.id.choose_activity_list_item_text1, displayInfos) {
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
|
||||
View view;
|
||||
ViewHolder viewHolder;
|
||||
if (convertView == null) {
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public class ChooseActivityTypeDialogFragment extends DialogFragment {
|
||||
/**
|
||||
* Called when choose activity type is done.
|
||||
*/
|
||||
public void onChooseActivityTypeDone(String iconValue, boolean newWeight);
|
||||
void onChooseActivityTypeDone(String iconValue, boolean newWeight);
|
||||
}
|
||||
|
||||
public static final String CHOOSE_ACTIVITY_TYPE_DIALOG_TAG = "chooseActivityType";
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class ConfirmDeleteDialogFragment extends AbstractMyTracksDialogFragment
|
||||
* @param trackIds list of track ids to delete. To delete all, set to size 1
|
||||
* with trackIds[0] == -1L
|
||||
*/
|
||||
public void onConfirmDeleteDone(long[] trackIds);
|
||||
void onConfirmDeleteDone(long[] trackIds);
|
||||
}
|
||||
|
||||
public static final String CONFIRM_DELETE_DIALOG_TAG = "confirmDeleteDialog";
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class DeleteMarkerDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
/**
|
||||
* Called when delete marker is done.
|
||||
*/
|
||||
public void onDeleteMarkerDone();
|
||||
void onDeleteMarkerDone();
|
||||
}
|
||||
|
||||
public static final String DELETE_MARKER_DIALOG_TAG = "deleteMarkerDialog";
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class FileTypeDialogFragment extends AbstractMyTracksDialogFragment {
|
||||
/**
|
||||
* Called when file type selection is done.
|
||||
*/
|
||||
public void onFileTypeDone(int menuId, TrackFileFormat trackFileFormat);
|
||||
void onFileTypeDone(int menuId, TrackFileFormat trackFileFormat);
|
||||
}
|
||||
|
||||
public static final String FILE_TYPE_DIALOG_TAG = "fileType";
|
||||
|
||||
+2
-2
@@ -143,9 +143,9 @@ public class MarkerDetailFragment extends Fragment {
|
||||
}
|
||||
});
|
||||
return view;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
|
||||
+2
-2
@@ -425,9 +425,9 @@ public class KmlTrackWriter implements TrackWriter {
|
||||
|
||||
private String getCoordinates(Location location, String separator) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append(location.getLongitude() + separator + location.getLatitude());
|
||||
buffer.append(location.getLongitude()).append(separator).append(location.getLatitude());
|
||||
if (location.hasAltitude()) {
|
||||
buffer.append(separator + location.getAltitude());
|
||||
buffer.append(separator).append(location.getAltitude());
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
+1
-1
@@ -185,7 +185,7 @@ public class KmzTrackExporter implements TrackExporter {
|
||||
try {
|
||||
fileInputStream = new FileInputStream(new File(uri.getPath()));
|
||||
byte[] buffer = new byte[BUFFER_SIZE];
|
||||
int byteCount = 0;
|
||||
int byteCount;
|
||||
while ((byteCount = fileInputStream.read(buffer)) != -1) {
|
||||
zipOutputStream.write(buffer, 0, byteCount);
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,5 +29,5 @@ public interface TrackExporterListener {
|
||||
* @param max the maximum number of locations in a track, for calculation of
|
||||
* completion percentage
|
||||
*/
|
||||
public void onProgressUpdate(int number, int max);
|
||||
void onProgressUpdate(int number, int max);
|
||||
}
|
||||
+15
-15
@@ -54,60 +54,60 @@ public interface TrackWriter {
|
||||
/**
|
||||
* Gets the file extension (e.g, gpx, kml, ...).
|
||||
*/
|
||||
public String getExtension();
|
||||
String getExtension();
|
||||
|
||||
/**
|
||||
* Prepares the output stream.
|
||||
*
|
||||
* @param outputStream the output stream
|
||||
*/
|
||||
public void prepare(OutputStream outputStream);
|
||||
void prepare(OutputStream outputStream);
|
||||
|
||||
/**
|
||||
* Closes the output stream.
|
||||
*/
|
||||
public void close();
|
||||
void close();
|
||||
|
||||
/**
|
||||
* Writes the header
|
||||
*
|
||||
* @param tracks the tracks
|
||||
*/
|
||||
public void writeHeader(Track[] tracks);
|
||||
void writeHeader(Track[] tracks);
|
||||
|
||||
/**
|
||||
* Writes the footer.
|
||||
*/
|
||||
public void writeFooter();
|
||||
void writeFooter();
|
||||
|
||||
/**
|
||||
* Writes the beginning of the waypoints.
|
||||
*
|
||||
* @param track the track
|
||||
*/
|
||||
public void writeBeginWaypoints(Track track);
|
||||
void writeBeginWaypoints(Track track);
|
||||
|
||||
/**
|
||||
* Writes the end of the waypoints.
|
||||
*/
|
||||
public void writeEndWaypoints();
|
||||
void writeEndWaypoints();
|
||||
|
||||
/**
|
||||
* Writes a waypoint.
|
||||
*
|
||||
* @param waypoint the waypoint
|
||||
*/
|
||||
public void writeWaypoint(Waypoint waypoint);
|
||||
void writeWaypoint(Waypoint waypoint);
|
||||
|
||||
/**
|
||||
* Writes the beginning of the tracks.
|
||||
*/
|
||||
public void writeBeginTracks();
|
||||
void writeBeginTracks();
|
||||
|
||||
/**
|
||||
* Writes the end of the tracks,
|
||||
*/
|
||||
public void writeEndTracks();
|
||||
void writeEndTracks();
|
||||
|
||||
/**
|
||||
* Writes the beginning of a track.
|
||||
@@ -115,7 +115,7 @@ public interface TrackWriter {
|
||||
* @param track the track
|
||||
* @param startLocation the start location
|
||||
*/
|
||||
public void writeBeginTrack(Track track, Location startLocation);
|
||||
void writeBeginTrack(Track track, Location startLocation);
|
||||
|
||||
/**
|
||||
* Writes the end of a track.
|
||||
@@ -123,22 +123,22 @@ public interface TrackWriter {
|
||||
* @param track the track
|
||||
* @param endLocation the end location
|
||||
*/
|
||||
public void writeEndTrack(Track track, Location endLocation);
|
||||
void writeEndTrack(Track track, Location endLocation);
|
||||
|
||||
/**
|
||||
* Writes open segment.
|
||||
*/
|
||||
public void writeOpenSegment();
|
||||
void writeOpenSegment();
|
||||
|
||||
/**
|
||||
* Writes close segment.
|
||||
*/
|
||||
public void writeCloseSegment();
|
||||
void writeCloseSegment();
|
||||
|
||||
/**
|
||||
* Writes a location.
|
||||
*
|
||||
* @param location the location
|
||||
*/
|
||||
public void writeLocation(Location location);
|
||||
void writeLocation(Location location);
|
||||
}
|
||||
+1
-1
@@ -30,5 +30,5 @@ public interface TrackImporter {
|
||||
* @param inputStream the file's input stream
|
||||
* @return the imported track id or -1L.
|
||||
*/
|
||||
public long importFile(InputStream inputStream);
|
||||
long importFile(InputStream inputStream);
|
||||
}
|
||||
|
||||
+3
-3
@@ -30,12 +30,12 @@ public interface LocationListenerPolicy {
|
||||
*
|
||||
* @return the polling interval
|
||||
*/
|
||||
public long getDesiredPollingInterval();
|
||||
long getDesiredPollingInterval();
|
||||
|
||||
/**
|
||||
* Returns the minimum distance between updates.
|
||||
*/
|
||||
public int getMinDistance();
|
||||
int getMinDistance();
|
||||
|
||||
/**
|
||||
* Notifies the amount of time the user has been idle at his current location.
|
||||
@@ -43,5 +43,5 @@ public interface LocationListenerPolicy {
|
||||
* @param idleTime the time that the user has been idle at his current
|
||||
* location
|
||||
*/
|
||||
public void updateIdleTime(long idleTime);
|
||||
void updateIdleTime(long idleTime);
|
||||
}
|
||||
|
||||
+3
-14
@@ -31,6 +31,7 @@ import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.os.Process;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.TaskStackBuilder;
|
||||
@@ -303,18 +304,6 @@ public class TrackRecordingService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that this service, through the AndroidManifest.xml, is configured to
|
||||
* allow both MyTracks and third party apps to invoke it. For the onStart
|
||||
* callback, we cannot tell whether the caller is MyTracks or a third party
|
||||
* app, thus it cannot start/stop a recording or write/update MyTracks
|
||||
* database.
|
||||
*/
|
||||
@Override
|
||||
public void onStart(Intent intent, int startId) {
|
||||
handleStartCommand(intent, startId);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that this service, through the AndroidManifest.xml, is configured to
|
||||
* allow both MyTracks and third party apps to invoke it. For the
|
||||
@@ -1157,12 +1146,12 @@ public class TrackRecordingService extends Service {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void linkToDeath(DeathRecipient recipient, int flags) {
|
||||
public void linkToDeath(@NonNull DeathRecipient recipient, int flags) {
|
||||
deathRecipient = recipient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unlinkToDeath(DeathRecipient recipient, int flags) {
|
||||
public boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags) {
|
||||
if (!isBinderAlive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+4
-4
@@ -25,11 +25,11 @@ import com.google.android.apps.mytracks.content.Sensor;
|
||||
*/
|
||||
public interface MessageParser {
|
||||
|
||||
public int getFrameSize();
|
||||
int getFrameSize();
|
||||
|
||||
public Sensor.SensorDataSet parseBuffer(byte[] readBuff);
|
||||
Sensor.SensorDataSet parseBuffer(byte[] readBuff);
|
||||
|
||||
public boolean isValid(byte[] buffer);
|
||||
boolean isValid(byte[] buffer);
|
||||
|
||||
public int findNextAlignment(byte[] buffer);
|
||||
int findNextAlignment(byte[] buffer);
|
||||
}
|
||||
|
||||
+1
-3
@@ -89,12 +89,10 @@ public class PolarMessageParser implements MessageParser {
|
||||
.setValue(heartRate)
|
||||
.setState(Sensor.SensorState.SENDING);
|
||||
|
||||
Sensor.SensorDataSet sds = Sensor.SensorDataSet.newBuilder()
|
||||
return Sensor.SensorDataSet.newBuilder()
|
||||
.setCreationTime(System.currentTimeMillis())
|
||||
.setHeartRate(b)
|
||||
.build();
|
||||
|
||||
return sds;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -27,17 +27,17 @@ public interface PeriodicTask {
|
||||
/**
|
||||
* Sets up this task for subsequent calls to the run method.
|
||||
*/
|
||||
public void start();
|
||||
void start();
|
||||
|
||||
/**
|
||||
* This method will be called periodically.
|
||||
*
|
||||
* @param trackRecordingService the track recording service
|
||||
*/
|
||||
public void run(TrackRecordingService trackRecordingService);
|
||||
void run(TrackRecordingService trackRecordingService);
|
||||
|
||||
/**
|
||||
* Shuts down this task and clean up resources.
|
||||
*/
|
||||
public void shutdown();
|
||||
void shutdown();
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,5 +30,5 @@ public interface PeriodicTaskFactory {
|
||||
*
|
||||
* @return the task, or null if the task is not supported
|
||||
*/
|
||||
public PeriodicTask create(Context context);
|
||||
PeriodicTask create(Context context);
|
||||
}
|
||||
+20
-30
@@ -203,22 +203,18 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity
|
||||
String displayValue;
|
||||
if (metricUnits) {
|
||||
displayValue = getString(R.string.value_integer_meter, value);
|
||||
switch (value) {
|
||||
case PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_meter_recommended, value);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
if (value == PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT) {
|
||||
options[i] = getString(R.string.value_integer_meter_recommended, value);
|
||||
} else {
|
||||
options[i] = displayValue;
|
||||
}
|
||||
} else {
|
||||
int feet = (int) (value * UnitConversions.M_TO_FT);
|
||||
displayValue = getString(R.string.value_integer_feet, feet);
|
||||
switch (value) {
|
||||
case PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_feet_recommended, feet);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
if (value == PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT) {
|
||||
options[i] = getString(R.string.value_integer_feet_recommended, feet);
|
||||
} else {
|
||||
options[i] = displayValue;
|
||||
}
|
||||
}
|
||||
summary[i] = getString(R.string.settings_recording_location_frequency_summary, displayValue);
|
||||
@@ -240,23 +236,19 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity
|
||||
String displayValue;
|
||||
if (metricUnits) {
|
||||
displayValue = getString(R.string.value_integer_meter, value);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_meter_recommended, value);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
if (value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT) {
|
||||
options[i] = getString(R.string.value_integer_meter_recommended, value);
|
||||
} else {
|
||||
options[i] = displayValue;
|
||||
}
|
||||
} else {
|
||||
int feet = (int) (value * UnitConversions.M_TO_FT);
|
||||
if (feet < 2000) {
|
||||
displayValue = getString(R.string.value_integer_feet, feet);
|
||||
switch (value) {
|
||||
case PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT:
|
||||
options[i] = getString(R.string.value_integer_feet_recommended, feet);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
if (value == PreferencesUtils.MAX_RECORDING_DISTANCE_DEFAULT) {
|
||||
options[i] = getString(R.string.value_integer_feet_recommended, feet);
|
||||
} else {
|
||||
options[i] = displayValue;
|
||||
}
|
||||
} else {
|
||||
double mile = feet * UnitConversions.FT_TO_MI;
|
||||
@@ -314,12 +306,10 @@ public class RecordingSettingsActivity extends AbstractSettingsActivity
|
||||
} else {
|
||||
double mile = feet * UnitConversions.FT_TO_MI;
|
||||
displayValue = getString(R.string.value_float_mile, mile);
|
||||
switch (value) {
|
||||
case PreferencesUtils.RECORDING_GPS_ACCURACY_POOR:
|
||||
options[i] = getString(R.string.value_float_mile_poor_gps, mile);
|
||||
break;
|
||||
default:
|
||||
options[i] = displayValue;
|
||||
if (value == PreferencesUtils.RECORDING_GPS_ACCURACY_POOR) {
|
||||
options[i] = getString(R.string.value_float_mile_poor_gps, mile);
|
||||
} else {
|
||||
options[i] = displayValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class ListItemUtils {
|
||||
if (buffer.length() != 0) {
|
||||
buffer.append(" ");
|
||||
}
|
||||
buffer.append("(" + totalDistance + ")");
|
||||
buffer.append("(").append(totalDistance).append(")");
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ public class StringUtils {
|
||||
*/
|
||||
public static String formatElapsedTime(long time) {
|
||||
/*
|
||||
* TODO
|
||||
* Temporary workaround for DateUtils.formatElapsedTime(time * MS_TO_S). In API
|
||||
* level 17, it returns strings like "1:0:00" instead of "1:00:00", which
|
||||
* breaks several unit tests.
|
||||
@@ -277,9 +278,9 @@ public class StringUtils {
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
buffer.append("[" + category + "]");
|
||||
buffer.append("[").append(category).append("]");
|
||||
if (description != null && description.length() != 0) {
|
||||
buffer.append(" " + description);
|
||||
buffer.append(" ").append(description);
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.ColorMatrixColorFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Pair;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
@@ -134,10 +135,8 @@ public class TrackIconUtils {
|
||||
* Gets all icon values.
|
||||
*/
|
||||
public static List<String> getAllIconValues() {
|
||||
List<String> values = new ArrayList<String>();
|
||||
for (String value : MAP.keySet()) {
|
||||
values.add(value);
|
||||
}
|
||||
List<String> values = new ArrayList<>();
|
||||
values.addAll(MAP.keySet());
|
||||
return values;
|
||||
}
|
||||
|
||||
@@ -191,10 +190,10 @@ public class TrackIconUtils {
|
||||
final Context context, String iconValue) {
|
||||
return new ArrayAdapter<StringBuilder>(context, android.R.layout.simple_spinner_item,
|
||||
new StringBuilder[] { new StringBuilder(iconValue) }) {
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(int position, View convertView, android.view.ViewGroup parent) {
|
||||
ImageView imageView = convertView != null ? (ImageView) convertView
|
||||
: new ImageView(getContext());
|
||||
public View getView(int position, View convertView, @NonNull android.view.ViewGroup parent) {
|
||||
ImageView imageView = convertView != null ? (ImageView) convertView : new ImageView(getContext());
|
||||
Bitmap source = BitmapFactory.decodeResource(
|
||||
context.getResources(), TrackIconUtils.getIconDrawable(getItem(position).toString()));
|
||||
imageView.setImageBitmap(source);
|
||||
|
||||
@@ -74,7 +74,7 @@ public class TrackNameUtils {
|
||||
if (location != null) {
|
||||
String address = getReverseGeoCoding(context, location);
|
||||
if (address != null && !address.equals("")) {
|
||||
value.append(" " + address);
|
||||
value.append(" ").append(address);
|
||||
}
|
||||
}
|
||||
return value.toString();
|
||||
|
||||
+3
-3
@@ -35,13 +35,13 @@ public interface DescriptionGenerator {
|
||||
* @param elevations a vector of elevations to generate the elevation chart
|
||||
* @param html true to output html, false to output plain text
|
||||
*/
|
||||
public String generateTrackDescription(
|
||||
Track track, Vector<Double> distances, Vector<Double> elevations, boolean html);
|
||||
String generateTrackDescription(
|
||||
Track track, Vector<Double> distances, Vector<Double> elevations, boolean html);
|
||||
|
||||
/**
|
||||
* Generate a waypoint description from a trip statistics.
|
||||
*
|
||||
* @param tripStatistics the trip statistics
|
||||
*/
|
||||
public String generateWaypointDescription(TripStatistics tripStatistics);
|
||||
String generateWaypointDescription(TripStatistics tripStatistics);
|
||||
}
|
||||
|
||||
+43
-43
@@ -38,45 +38,45 @@ public interface MyTracksProviderUtils {
|
||||
* The authority (the first part of the URI) for the My Tracks content
|
||||
* provider.
|
||||
*/
|
||||
public static final String AUTHORITY = "com.google.android.maps.mytracks";
|
||||
String AUTHORITY = "com.google.android.maps.mytracks";
|
||||
|
||||
/**
|
||||
* Clears a track. Removes waypoints and trackpoints. Only keeps the track id.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public void clearTrack(Context context, long trackId);
|
||||
void clearTrack(Context context, long trackId);
|
||||
|
||||
/**
|
||||
* Creates a {@link Track} from a cursor.
|
||||
*
|
||||
* @param cursor the cursor pointing to the track
|
||||
*/
|
||||
public Track createTrack(Cursor cursor);
|
||||
Track createTrack(Cursor cursor);
|
||||
|
||||
/**
|
||||
* Deletes all tracks (including waypoints and track points).
|
||||
*/
|
||||
public void deleteAllTracks(Context context);
|
||||
void deleteAllTracks(Context context);
|
||||
|
||||
/**
|
||||
* Deletes a track.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public void deleteTrack(Context context, long trackId);
|
||||
void deleteTrack(Context context, long trackId);
|
||||
|
||||
/**
|
||||
* Gets all the tracks. If no track exists, an empty list is returned.
|
||||
* <p>
|
||||
* Note that the returned tracks do not have any track points attached.
|
||||
*/
|
||||
public List<Track> getAllTracks();
|
||||
List<Track> getAllTracks();
|
||||
|
||||
/**
|
||||
* Gets the last track. Returns null if doesn't exist.
|
||||
*/
|
||||
public Track getLastTrack();
|
||||
Track getLastTrack();
|
||||
|
||||
/**
|
||||
* Gets a track by a track id. Returns null if not found.
|
||||
@@ -85,7 +85,7 @@ public interface MyTracksProviderUtils {
|
||||
*
|
||||
* @param trackId the track id.
|
||||
*/
|
||||
public Track getTrack(long trackId);
|
||||
Track getTrack(long trackId);
|
||||
|
||||
/**
|
||||
* Gets a track cursor. The caller owns the returned cursor and is responsible
|
||||
@@ -95,7 +95,7 @@ public interface MyTracksProviderUtils {
|
||||
* @param selectionArgs the selection arguments. Can be null
|
||||
* @param sortOrder the sort order. Can be null
|
||||
*/
|
||||
public Cursor getTrackCursor(String selection, String[] selectionArgs, String sortOrder);
|
||||
Cursor getTrackCursor(String selection, String[] selectionArgs, String sortOrder);
|
||||
|
||||
/**
|
||||
* Inserts a track.
|
||||
@@ -105,7 +105,7 @@ public interface MyTracksProviderUtils {
|
||||
* @param track the track
|
||||
* @return the content provider URI of the inserted track.
|
||||
*/
|
||||
public Uri insertTrack(Track track);
|
||||
Uri insertTrack(Track track);
|
||||
|
||||
/**
|
||||
* Updates a track.
|
||||
@@ -114,14 +114,14 @@ public interface MyTracksProviderUtils {
|
||||
*
|
||||
* @param track the track
|
||||
*/
|
||||
public void updateTrack(Track track);
|
||||
void updateTrack(Track track);
|
||||
|
||||
/**
|
||||
* Creates a waypoint from a cursor.
|
||||
*
|
||||
* @param cursor the cursor pointing to the waypoint
|
||||
*/
|
||||
public Waypoint createWaypoint(Cursor cursor);
|
||||
Waypoint createWaypoint(Cursor cursor);
|
||||
|
||||
/**
|
||||
* Deletes a waypoint. If deleting a statistics waypoint, this will also
|
||||
@@ -132,7 +132,7 @@ public interface MyTracksProviderUtils {
|
||||
* @param descriptionGenerator the description generator. Can be null for
|
||||
* waypoint marker
|
||||
*/
|
||||
public void deleteWaypoint(Context context, long waypointId, DescriptionGenerator descriptionGenerator);
|
||||
void deleteWaypoint(Context context, long waypointId, DescriptionGenerator descriptionGenerator);
|
||||
|
||||
/**
|
||||
* Gets the first waypoint id for a track. The first waypoint is special as it
|
||||
@@ -140,7 +140,7 @@ public interface MyTracksProviderUtils {
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public long getFirstWaypointId(long trackId);
|
||||
long getFirstWaypointId(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the last waypoint for a type. Returns null if it doesn't exist.
|
||||
@@ -148,7 +148,7 @@ public interface MyTracksProviderUtils {
|
||||
* @param trackId the track id
|
||||
* @param waypointType the waypoint type
|
||||
*/
|
||||
public Waypoint getLastWaypoint(long trackId, WaypointType waypointType);
|
||||
Waypoint getLastWaypoint(long trackId, WaypointType waypointType);
|
||||
|
||||
/**
|
||||
* Gets the next waypoint number for a type. Returns -1 if not able to get the
|
||||
@@ -157,14 +157,14 @@ public interface MyTracksProviderUtils {
|
||||
* @param trackId the track id
|
||||
* @param waypointType the waypoint type
|
||||
*/
|
||||
public int getNextWaypointNumber(long trackId, WaypointType waypointType);
|
||||
int getNextWaypointNumber(long trackId, WaypointType waypointType);
|
||||
|
||||
/**
|
||||
* Gets a waypoint from a waypoint id. Returns null if not found.
|
||||
*
|
||||
* @param waypointId the waypoint id
|
||||
*/
|
||||
public Waypoint getWaypoint(long waypointId);
|
||||
Waypoint getWaypoint(long waypointId);
|
||||
|
||||
/**
|
||||
* Gets a waypoint cursor. The caller owns the returned cursor and is
|
||||
@@ -176,8 +176,8 @@ public interface MyTracksProviderUtils {
|
||||
* @param maxWaypoints the maximum number of waypoints to return. -1 for no
|
||||
* limit
|
||||
*/
|
||||
public Cursor getWaypointCursor(
|
||||
String selection, String[] selectionArgs, String sortOrder, int maxWaypoints);
|
||||
Cursor getWaypointCursor(
|
||||
String selection, String[] selectionArgs, String sortOrder, int maxWaypoints);
|
||||
|
||||
/**
|
||||
* Gets a waypoint cursor for a track. The caller owns the returned cursor and
|
||||
@@ -188,14 +188,14 @@ public interface MyTracksProviderUtils {
|
||||
* @param maxWaypoints the maximum number of waypoints to return. -1 for no
|
||||
* limit
|
||||
*/
|
||||
public Cursor getWaypointCursor(long trackId, long minWaypointId, int maxWaypoints);
|
||||
Cursor getWaypointCursor(long trackId, long minWaypointId, int maxWaypoints);
|
||||
|
||||
/**
|
||||
* Gets the number of waypoints for a track.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public int getWaypointCount(long trackId);
|
||||
int getWaypointCount(long trackId);
|
||||
|
||||
/**
|
||||
* Inserts a waypoint.
|
||||
@@ -203,14 +203,14 @@ public interface MyTracksProviderUtils {
|
||||
* @param waypoint the waypoint
|
||||
* @return the content provider URI of the inserted waypoint.
|
||||
*/
|
||||
public Uri insertWaypoint(Waypoint waypoint);
|
||||
Uri insertWaypoint(Waypoint waypoint);
|
||||
|
||||
/**
|
||||
* Updates a waypoint. Returns true if successful.
|
||||
*
|
||||
* @param waypoint the waypoint
|
||||
*/
|
||||
public boolean updateWaypoint(Waypoint waypoint);
|
||||
boolean updateWaypoint(Waypoint waypoint);
|
||||
|
||||
/**
|
||||
* Inserts multiple track points.
|
||||
@@ -221,28 +221,28 @@ public interface MyTracksProviderUtils {
|
||||
* @param trackId the track id
|
||||
* @return the number of points inserted
|
||||
*/
|
||||
public int bulkInsertTrackPoint(Location[] locations, int length, long trackId);
|
||||
int bulkInsertTrackPoint(Location[] locations, int length, long trackId);
|
||||
|
||||
/**
|
||||
* Creates a location object from a cursor.
|
||||
*
|
||||
* @param cursor the cursor pointing to the location
|
||||
*/
|
||||
public Location createTrackPoint(Cursor cursor);
|
||||
Location createTrackPoint(Cursor cursor);
|
||||
|
||||
/**
|
||||
* Gets the first location id for a track. Returns -1L if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public long getFirstTrackPointId(long trackId);
|
||||
long getFirstTrackPointId(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the last location id for a track. Returns -1L if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public long getLastTrackPointId(long trackId);
|
||||
long getLastTrackPointId(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the track point id of a location.
|
||||
@@ -251,7 +251,7 @@ public interface MyTracksProviderUtils {
|
||||
* @param location the location
|
||||
* @return track point id if the location is in the track. -1L otherwise.
|
||||
*/
|
||||
public long getTrackPointId(long trackId, Location location);
|
||||
long getTrackPointId(long trackId, Location location);
|
||||
|
||||
/**
|
||||
* Gets the first valid location for a track. Returns null if it doesn't
|
||||
@@ -259,20 +259,20 @@ public interface MyTracksProviderUtils {
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public Location getFirstValidTrackPoint(long trackId);
|
||||
Location getFirstValidTrackPoint(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the last valid location for a track. Returns null if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public Location getLastValidTrackPoint(long trackId);
|
||||
Location getLastValidTrackPoint(long trackId);
|
||||
|
||||
|
||||
/**
|
||||
* Gets the last valid location.
|
||||
*/
|
||||
public Location getLastValidTrackPoint();
|
||||
Location getLastValidTrackPoint();
|
||||
|
||||
/**
|
||||
* Creates a location cursor. The caller owns the returned cursor and is
|
||||
@@ -284,8 +284,8 @@ public interface MyTracksProviderUtils {
|
||||
* @param descending true to sort the result in descending order (latest
|
||||
* location first)
|
||||
*/
|
||||
public Cursor getTrackPointCursor(
|
||||
long trackId, long startTrackPointId, int maxLocations, boolean descending);
|
||||
Cursor getTrackPointCursor(
|
||||
long trackId, long startTrackPointId, int maxLocations, boolean descending);
|
||||
|
||||
/**
|
||||
* Creates a new read-only iterator over a given track's points. It provides a
|
||||
@@ -304,8 +304,8 @@ public interface MyTracksProviderUtils {
|
||||
* location first)
|
||||
* @param locationFactory the location factory
|
||||
*/
|
||||
public LocationIterator getTrackPointLocationIterator(
|
||||
long trackId, long startTrackPointId, boolean descending, LocationFactory locationFactory);
|
||||
LocationIterator getTrackPointLocationIterator(
|
||||
long trackId, long startTrackPointId, boolean descending, LocationFactory locationFactory);
|
||||
|
||||
/**
|
||||
* Inserts a track point.
|
||||
@@ -314,41 +314,41 @@ public interface MyTracksProviderUtils {
|
||||
* @param trackId the track id
|
||||
* @return the content provider URI of the inserted track point
|
||||
*/
|
||||
public Uri insertTrackPoint(Location location, long trackId);
|
||||
Uri insertTrackPoint(Location location, long trackId);
|
||||
|
||||
/**
|
||||
* A lightweight wrapper around the original {@link Cursor} with a method to
|
||||
* clean up.
|
||||
*/
|
||||
public interface LocationIterator extends Iterator<Location> {
|
||||
interface LocationIterator extends Iterator<Location> {
|
||||
|
||||
/**
|
||||
* Gets the most recently retrieved track point id by {@link #next()}.
|
||||
*/
|
||||
public long getLocationId();
|
||||
long getLocationId();
|
||||
|
||||
/**
|
||||
* Closes the iterator.
|
||||
*/
|
||||
public void close();
|
||||
void close();
|
||||
}
|
||||
|
||||
/**
|
||||
* A factory for creating new {@link Location}.
|
||||
*/
|
||||
public interface LocationFactory {
|
||||
interface LocationFactory {
|
||||
|
||||
/**
|
||||
* Creates a new {@link Location}. An implementation can create new
|
||||
* instances or reuse existing instances for optimization.
|
||||
*/
|
||||
public Location createLocation();
|
||||
Location createLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* The default {@link LocationFactory} which creates a location each time.
|
||||
*/
|
||||
public LocationFactory DEFAULT_LOCATION_FACTORY = new LocationFactory() {
|
||||
LocationFactory DEFAULT_LOCATION_FACTORY = new LocationFactory() {
|
||||
@Override
|
||||
public Location createLocation() {
|
||||
return new MyTracksLocation(LocationManager.GPS_PROVIDER);
|
||||
@@ -359,7 +359,7 @@ public interface MyTracksProviderUtils {
|
||||
* A factory which can produce instances of {@link MyTracksProviderUtils}, and
|
||||
* can be overridden for testing.
|
||||
*/
|
||||
public static class Factory {
|
||||
class Factory {
|
||||
|
||||
private static Factory instance = new Factory();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public final class Sensor {
|
||||
|
||||
private final int index;
|
||||
private final int value;
|
||||
private SensorState(int index, int value) {
|
||||
SensorState(int index, int value) {
|
||||
this.index = index;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
+17
-17
@@ -31,25 +31,25 @@ import android.provider.BaseColumns;
|
||||
*/
|
||||
public interface TrackPointsColumns extends BaseColumns {
|
||||
|
||||
public static final String TABLE_NAME = "trackpoints";
|
||||
public static final Uri CONTENT_URI = Uri.parse(
|
||||
String TABLE_NAME = "trackpoints";
|
||||
Uri CONTENT_URI = Uri.parse(
|
||||
"content://com.google.android.maps.mytracks/trackpoints");
|
||||
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.trackpoint";
|
||||
public static final String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.google.trackpoint";
|
||||
public static final String DEFAULT_SORT_ORDER = "_id";
|
||||
String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.trackpoint";
|
||||
String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.google.trackpoint";
|
||||
String DEFAULT_SORT_ORDER = "_id";
|
||||
|
||||
// Columns
|
||||
public static final String TRACKID = "trackid"; // track id
|
||||
public static final String LONGITUDE = "longitude"; // longitude
|
||||
public static final String LATITUDE = "latitude"; // latitude
|
||||
public static final String TIME = "time"; // time
|
||||
public static final String ALTITUDE = "elevation"; // altitude
|
||||
public static final String ACCURACY = "accuracy"; // accuracy
|
||||
public static final String SPEED = "speed"; // speed
|
||||
public static final String BEARING = "bearing"; // bearing
|
||||
public static final String SENSOR = "sensor"; // sensor
|
||||
String TRACKID = "trackid"; // track id
|
||||
String LONGITUDE = "longitude"; // longitude
|
||||
String LATITUDE = "latitude"; // latitude
|
||||
String TIME = "time"; // time
|
||||
String ALTITUDE = "elevation"; // altitude
|
||||
String ACCURACY = "accuracy"; // accuracy
|
||||
String SPEED = "speed"; // speed
|
||||
String BEARING = "bearing"; // bearing
|
||||
String SENSOR = "sensor"; // sensor
|
||||
|
||||
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ("
|
||||
String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ("
|
||||
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||
+ TRACKID + " INTEGER, "
|
||||
+ LONGITUDE + " INTEGER, "
|
||||
@@ -62,7 +62,7 @@ public interface TrackPointsColumns extends BaseColumns {
|
||||
+ SENSOR + " BLOB"
|
||||
+ ");";
|
||||
|
||||
public static final String[] COLUMNS = {
|
||||
String[] COLUMNS = {
|
||||
_ID,
|
||||
TRACKID,
|
||||
LONGITUDE,
|
||||
@@ -75,7 +75,7 @@ public interface TrackPointsColumns extends BaseColumns {
|
||||
SENSOR
|
||||
};
|
||||
|
||||
public static final byte[] COLUMN_TYPES = {
|
||||
byte[] COLUMN_TYPES = {
|
||||
LONG_TYPE_ID, // id
|
||||
LONG_TYPE_ID, // track id
|
||||
INT_TYPE_ID, // longitude
|
||||
|
||||
+39
-39
@@ -26,73 +26,73 @@ import android.provider.BaseColumns;
|
||||
*/
|
||||
public interface TracksColumns extends BaseColumns {
|
||||
|
||||
public static final String TABLE_NAME = "tracks";
|
||||
String TABLE_NAME = "tracks";
|
||||
|
||||
/**
|
||||
* Tracks provider uri.
|
||||
*/
|
||||
public static final Uri CONTENT_URI = Uri.parse(
|
||||
Uri CONTENT_URI = Uri.parse(
|
||||
"content://com.google.android.maps.mytracks/tracks");
|
||||
|
||||
/**
|
||||
* Track content type.
|
||||
*/
|
||||
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.track";
|
||||
String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.track";
|
||||
|
||||
/**
|
||||
* Track id content type.
|
||||
*/
|
||||
public static final String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.google.track";
|
||||
String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.google.track";
|
||||
|
||||
/**
|
||||
* Tracks table default sort order.
|
||||
*/
|
||||
public static final String DEFAULT_SORT_ORDER = "_id";
|
||||
String DEFAULT_SORT_ORDER = "_id";
|
||||
|
||||
// Columns
|
||||
public static final String NAME = "name"; // track name
|
||||
public static final String DESCRIPTION = "description"; // track description
|
||||
public static final String CATEGORY = "category"; // track activity type
|
||||
public static final String STARTID = "startid"; // first track point id
|
||||
public static final String STOPID = "stopid"; // last track point id
|
||||
public static final String STARTTIME = "starttime"; // track start time
|
||||
public static final String STOPTIME = "stoptime"; // track stop time
|
||||
public static final String NUMPOINTS = "numpoints"; // number of track points
|
||||
public static final String TOTALDISTANCE = "totaldistance"; // total distance
|
||||
public static final String TOTALTIME = "totaltime"; // total time
|
||||
public static final String MOVINGTIME = "movingtime"; // moving time
|
||||
public static final String MINLAT = "minlat"; // minimum latitude
|
||||
public static final String MAXLAT = "maxlat"; // maximum latitude
|
||||
public static final String MINLON = "minlon"; // minimum longitude
|
||||
public static final String MAXLON = "maxlon"; // maximum longitude
|
||||
public static final String AVGSPEED = "avgspeed"; // average speed
|
||||
String NAME = "name"; // track name
|
||||
String DESCRIPTION = "description"; // track description
|
||||
String CATEGORY = "category"; // track activity type
|
||||
String STARTID = "startid"; // first track point id
|
||||
String STOPID = "stopid"; // last track point id
|
||||
String STARTTIME = "starttime"; // track start time
|
||||
String STOPTIME = "stoptime"; // track stop time
|
||||
String NUMPOINTS = "numpoints"; // number of track points
|
||||
String TOTALDISTANCE = "totaldistance"; // total distance
|
||||
String TOTALTIME = "totaltime"; // total time
|
||||
String MOVINGTIME = "movingtime"; // moving time
|
||||
String MINLAT = "minlat"; // minimum latitude
|
||||
String MAXLAT = "maxlat"; // maximum latitude
|
||||
String MINLON = "minlon"; // minimum longitude
|
||||
String MAXLON = "maxlon"; // maximum longitude
|
||||
String AVGSPEED = "avgspeed"; // average speed
|
||||
|
||||
// average moving speed
|
||||
public static final String AVGMOVINGSPEED = "avgmovingspeed";
|
||||
public static final String MAXSPEED = "maxspeed"; // maximum speed
|
||||
public static final String MINELEVATION = "minelevation"; // minimum elevation
|
||||
public static final String MAXELEVATION = "maxelevation"; // maximum elevation
|
||||
public static final String ELEVATIONGAIN = "elevationgain"; // elevation gain
|
||||
public static final String MINGRADE = "mingrade"; // minimum grade
|
||||
public static final String MAXGRADE = "maxgrade"; // maximum grade
|
||||
public static final String MAPID = "mapid"; // Google Maps id
|
||||
public static final String TABLEID = "tableid"; // Google Fusion Tables id
|
||||
public static final String ICON = "icon"; // track activity type icon
|
||||
public static final String DRIVEID = "driveid"; // Google Drive file id
|
||||
String AVGMOVINGSPEED = "avgmovingspeed";
|
||||
String MAXSPEED = "maxspeed"; // maximum speed
|
||||
String MINELEVATION = "minelevation"; // minimum elevation
|
||||
String MAXELEVATION = "maxelevation"; // maximum elevation
|
||||
String ELEVATIONGAIN = "elevationgain"; // elevation gain
|
||||
String MINGRADE = "mingrade"; // minimum grade
|
||||
String MAXGRADE = "maxgrade"; // maximum grade
|
||||
String MAPID = "mapid"; // Google Maps id
|
||||
String TABLEID = "tableid"; // Google Fusion Tables id
|
||||
String ICON = "icon"; // track activity type icon
|
||||
String DRIVEID = "driveid"; // Google Drive file id
|
||||
|
||||
// Google drive file modified time
|
||||
public static final String MODIFIEDTIME = "modifiedtime";
|
||||
String MODIFIEDTIME = "modifiedtime";
|
||||
|
||||
// 1 if the Google Drive file is from the "Shared with me" directory
|
||||
public static final String SHAREDWITHME = "sharedwithme";
|
||||
String SHAREDWITHME = "sharedwithme";
|
||||
|
||||
// The owner of the shared with me track
|
||||
public static final String SHAREDOWNER = "sharedOwner";
|
||||
String SHAREDOWNER = "sharedOwner";
|
||||
|
||||
// Calorie burned of the track
|
||||
public static final String CALORIE = "calorie";
|
||||
String CALORIE = "calorie";
|
||||
|
||||
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" // table
|
||||
String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" // table
|
||||
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " // id
|
||||
+ NAME + " STRING, " // name
|
||||
+ DESCRIPTION + " STRING, " // description
|
||||
@@ -126,7 +126,7 @@ public interface TracksColumns extends BaseColumns {
|
||||
+ SHAREDOWNER + " STRING, " // shared owner
|
||||
+ CALORIE + " FLOAT);"; // calorie
|
||||
|
||||
public static final String[] COLUMNS = { _ID, // id
|
||||
String[] COLUMNS = { _ID, // id
|
||||
NAME, // name
|
||||
DESCRIPTION, // description
|
||||
CATEGORY, // category
|
||||
@@ -159,7 +159,7 @@ public interface TracksColumns extends BaseColumns {
|
||||
SHAREDOWNER,// shared owner
|
||||
CALORIE }; // calorie
|
||||
|
||||
public static final byte[] COLUMN_TYPES = { ContentTypeIds.LONG_TYPE_ID, // id
|
||||
byte[] COLUMN_TYPES = { ContentTypeIds.LONG_TYPE_ID, // id
|
||||
ContentTypeIds.STRING_TYPE_ID, // name
|
||||
ContentTypeIds.STRING_TYPE_ID, // description
|
||||
ContentTypeIds.STRING_TYPE_ID, // category
|
||||
|
||||
@@ -30,8 +30,8 @@ import android.os.Parcelable;
|
||||
*/
|
||||
public final class Waypoint implements Parcelable {
|
||||
|
||||
public static enum WaypointType {
|
||||
WAYPOINT, STATISTICS;
|
||||
public enum WaypointType {
|
||||
WAYPOINT, STATISTICS
|
||||
}
|
||||
|
||||
private long id = -1L;
|
||||
|
||||
+1
-2
@@ -62,7 +62,7 @@ public class WaypointCreationRequest implements Parcelable {
|
||||
|
||||
@Override
|
||||
public WaypointCreationRequest createFromParcel(Parcel source) {
|
||||
WaypointCreationRequest request = new WaypointCreationRequest(
|
||||
return new WaypointCreationRequest(
|
||||
WaypointType.values()[source.readInt()],
|
||||
source.readByte() == 1,
|
||||
source.readString(),
|
||||
@@ -70,7 +70,6 @@ public class WaypointCreationRequest implements Parcelable {
|
||||
source.readString(),
|
||||
source.readString(),
|
||||
source.readString());
|
||||
return request;
|
||||
}
|
||||
|
||||
public WaypointCreationRequest[] newArray(int size) {
|
||||
|
||||
+39
-39
@@ -31,50 +31,50 @@ import android.provider.BaseColumns;
|
||||
*/
|
||||
public interface WaypointsColumns extends BaseColumns {
|
||||
|
||||
public static final String TABLE_NAME = "waypoints";
|
||||
public static final Uri CONTENT_URI = Uri.parse(
|
||||
String TABLE_NAME = "waypoints";
|
||||
Uri CONTENT_URI = Uri.parse(
|
||||
"content://com.google.android.maps.mytracks/waypoints");
|
||||
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.waypoint";
|
||||
public static final String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.google.waypoint";
|
||||
public static final String DEFAULT_SORT_ORDER = "_id";
|
||||
String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.waypoint";
|
||||
String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.google.waypoint";
|
||||
String DEFAULT_SORT_ORDER = "_id";
|
||||
|
||||
// Columns
|
||||
public static final String NAME = "name"; // waypoint name
|
||||
public static final String DESCRIPTION = "description"; // waypoint description
|
||||
public static final String CATEGORY = "category"; // waypoint category
|
||||
public static final String ICON = "icon"; // waypoint icon
|
||||
public static final String TRACKID = "trackid"; // track id
|
||||
public static final String TYPE = "type"; // type
|
||||
public static final String LENGTH = "length"; // length of the track (without smoothing)
|
||||
public static final String DURATION = "duration"; // total duration of the track (not from last waypoint)
|
||||
public static final String STARTTIME = "starttime"; // start time of the trip statistics
|
||||
public static final String STARTID = "startid"; // start track point id
|
||||
public static final String STOPID = "stopid"; // stop track point id
|
||||
String NAME = "name"; // waypoint name
|
||||
String DESCRIPTION = "description"; // waypoint description
|
||||
String CATEGORY = "category"; // waypoint category
|
||||
String ICON = "icon"; // waypoint icon
|
||||
String TRACKID = "trackid"; // track id
|
||||
String TYPE = "type"; // type
|
||||
String LENGTH = "length"; // length of the track (without smoothing)
|
||||
String DURATION = "duration"; // total duration of the track (not from last waypoint)
|
||||
String STARTTIME = "starttime"; // start time of the trip statistics
|
||||
String STARTID = "startid"; // start track point id
|
||||
String STOPID = "stopid"; // stop track point id
|
||||
|
||||
public static final String LONGITUDE = "longitude"; // longitude
|
||||
public static final String LATITUDE = "latitude"; // latitude
|
||||
public static final String TIME = "time"; // time
|
||||
public static final String ALTITUDE = "elevation"; // altitude
|
||||
public static final String ACCURACY = "accuracy"; // accuracy
|
||||
public static final String SPEED = "speed"; // speed
|
||||
public static final String BEARING = "bearing"; // bearing
|
||||
String LONGITUDE = "longitude"; // longitude
|
||||
String LATITUDE = "latitude"; // latitude
|
||||
String TIME = "time"; // time
|
||||
String ALTITUDE = "elevation"; // altitude
|
||||
String ACCURACY = "accuracy"; // accuracy
|
||||
String SPEED = "speed"; // speed
|
||||
String BEARING = "bearing"; // bearing
|
||||
|
||||
public static final String TOTALDISTANCE = "totaldistance"; // total distance
|
||||
public static final String TOTALTIME = "totaltime"; // total time
|
||||
public static final String MOVINGTIME = "movingtime"; // moving time
|
||||
public static final String AVGSPEED = "avgspeed"; // average speed
|
||||
public static final String AVGMOVINGSPEED = "avgmovingspeed"; // average moving speed
|
||||
public static final String MAXSPEED = "maxspeed"; // max speed
|
||||
public static final String MINELEVATION = "minelevation"; // min elevation
|
||||
public static final String MAXELEVATION = "maxelevation"; // max elevation
|
||||
public static final String ELEVATIONGAIN = "elevationgain"; // elevation gain
|
||||
public static final String MINGRADE = "mingrade"; // min grade
|
||||
public static final String MAXGRADE = "maxgrade"; // max grade
|
||||
public static final String CALORIE = "calorie"; // calorie
|
||||
String TOTALDISTANCE = "totaldistance"; // total distance
|
||||
String TOTALTIME = "totaltime"; // total time
|
||||
String MOVINGTIME = "movingtime"; // moving time
|
||||
String AVGSPEED = "avgspeed"; // average speed
|
||||
String AVGMOVINGSPEED = "avgmovingspeed"; // average moving speed
|
||||
String MAXSPEED = "maxspeed"; // max speed
|
||||
String MINELEVATION = "minelevation"; // min elevation
|
||||
String MAXELEVATION = "maxelevation"; // max elevation
|
||||
String ELEVATIONGAIN = "elevationgain"; // elevation gain
|
||||
String MINGRADE = "mingrade"; // min grade
|
||||
String MAXGRADE = "maxgrade"; // max grade
|
||||
String CALORIE = "calorie"; // calorie
|
||||
|
||||
public static final String PHOTOURL = "photoUrl"; // url for the photo
|
||||
String PHOTOURL = "photoUrl"; // url for the photo
|
||||
|
||||
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ("
|
||||
String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ("
|
||||
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||
+ NAME + " STRING, "
|
||||
+ DESCRIPTION + " STRING, "
|
||||
@@ -109,7 +109,7 @@ public interface WaypointsColumns extends BaseColumns {
|
||||
+ PHOTOURL + " STRING"
|
||||
+ ");";
|
||||
|
||||
public static final String[] COLUMNS = {
|
||||
String[] COLUMNS = {
|
||||
_ID,
|
||||
NAME,
|
||||
DESCRIPTION,
|
||||
@@ -144,7 +144,7 @@ public interface WaypointsColumns extends BaseColumns {
|
||||
PHOTOURL
|
||||
};
|
||||
|
||||
public static final byte[] COLUMN_TYPES = {
|
||||
byte[] COLUMN_TYPES = {
|
||||
LONG_TYPE_ID, // id
|
||||
STRING_TYPE_ID, // name
|
||||
STRING_TYPE_ID, // description
|
||||
|
||||
@@ -106,7 +106,7 @@ public class FileUtils {
|
||||
}
|
||||
|
||||
public static File getPhotoDir(long trackId) {
|
||||
return new File(getPath(PICTURES_DIR, "MyTracks" + Long.toString(trackId)));
|
||||
return new File(getPath(PICTURES_DIR, "MyTracks" + trackId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +197,7 @@ public class FileUtils {
|
||||
File directory, String base, String extension, int suffix) {
|
||||
String suffixName = "";
|
||||
if (suffix > 0) {
|
||||
suffixName += "(" + Integer.toString(suffix) + ")";
|
||||
suffixName += "(" + suffix + ")";
|
||||
}
|
||||
suffixName += "." + extension;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user