forked from upstream-mirrors/OpenTracks
Lint cleanup.
This commit is contained in:
+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();
|
||||
|
||||
Reference in New Issue
Block a user