Style and warning fixes.

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