Clean up tab/space mistmatch in RetroActivityLocation.java

This commit is contained in:
Lioncash 2013-12-21 17:01:20 -05:00
parent b0a6a5f118
commit 192bf387d4

View File

@ -43,21 +43,21 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
@Override @Override
public void onConnected(Bundle dataBundle) public void onConnected(Bundle dataBundle)
{ {
// Display the connection status // Display the connection status
Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show();
location_service_running = true; location_service_running = true;
// If already requested, start periodic updates // If already requested, start periodic updates
if (mUpdatesRequested) if (mUpdatesRequested)
{ {
mLocationClient.requestLocationUpdates(mLocationRequest, this, null); mLocationClient.requestLocationUpdates(mLocationRequest, this, null);
} }
else else
{ {
// Get last known location // Get last known location
mCurrentLocation = mLocationClient.getLastLocation(); mCurrentLocation = mLocationClient.getLastLocation();
locationChanged = true; locationChanged = true;
} }
} }
/** /**
@ -67,21 +67,21 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
@Override @Override
public void onDisconnected() public void onDisconnected()
{ {
// Display the connection status // Display the connection status
Toast.makeText(this, "Disconnected. Please re-connect.", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Disconnected. Please re-connect.", Toast.LENGTH_SHORT).show();
// If the client is connected // If the client is connected
if (mLocationClient.isConnected()) if (mLocationClient.isConnected())
{ {
/* /*
* Remove location updates for a listener. * Remove location updates for a listener.
* The current Activity is the listener, so * The current Activity is the listener, so
* the argument is "this". * the argument is "this".
*/ */
mLocationClient.removeLocationUpdates(this); mLocationClient.removeLocationUpdates(this);
} }
location_service_running = false; location_service_running = false;
} }
/** /**
@ -91,73 +91,73 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
@Override @Override
public void onConnectionFailed(ConnectionResult connectionResult) public void onConnectionFailed(ConnectionResult connectionResult)
{ {
/* /*
* Google Play services can resolve some errors it detects. * Google Play services can resolve some errors it detects.
* If the error has a resolution, try sending an Intent to * If the error has a resolution, try sending an Intent to
* start a Google Play services activity that can resolve * start a Google Play services activity that can resolve
* error. * error.
*/ */
if (connectionResult.hasResolution()) if (connectionResult.hasResolution())
{ {
try try
{ {
// Start an Activity that tries to resolve the error // Start an Activity that tries to resolve the error
connectionResult.startResolutionForResult(this, CONNECTION_FAILURE_RESOLUTION_REQUEST); connectionResult.startResolutionForResult(this, CONNECTION_FAILURE_RESOLUTION_REQUEST);
} }
catch (IntentSender.SendIntentException e) catch (IntentSender.SendIntentException e)
{ {
// Thrown if Google Play services cancelled the original PendingIntent // Thrown if Google Play services cancelled the original PendingIntent
e.printStackTrace(); e.printStackTrace();
} }
} }
else else
{ {
/* /*
* If no resolution is available, display a dialog to the * If no resolution is available, display a dialog to the
* user with the error. * user with the error.
*/ */
Log.e("Connection failed", "error code: " + connectionResult.getErrorCode()); Log.e("Connection failed", "error code: " + connectionResult.getErrorCode());
} }
} }
/** /**
* Sets the update interval at which location-based updates * Sets the update interval at which location-based updates
* should occur * should occur
*/ */
public void onLocationSetInterval(int update_interval_in_ms, int distance_interval) public void onLocationSetInterval(int update_interval_in_ms, int distance_interval)
{ {
// Use high accuracy // Use high accuracy
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
if (update_interval_in_ms == 0) if (update_interval_in_ms == 0)
mLocationRequest.setInterval(5 * 1000); // 5 seconds mLocationRequest.setInterval(5 * 1000); // 5 seconds
else else
mLocationRequest.setInterval(update_interval_in_ms); mLocationRequest.setInterval(update_interval_in_ms);
// Set the fastest update interval to 1 second // Set the fastest update interval to 1 second
mLocationRequest.setFastestInterval(1000); mLocationRequest.setFastestInterval(1000);
} }
/** /**
* Initializing methods for location based functionality. * Initializing methods for location based functionality.
*/ */
public void onLocationInit() public void onLocationInit()
{ {
/* /*
* Create a new location client, using the enclosing class to * Create a new location client, using the enclosing class to
* handle callbacks. * handle callbacks.
*/ */
if (mLocationClient == null) if (mLocationClient == null)
mLocationClient = new LocationClient(this, this, this); mLocationClient = new LocationClient(this, this, this);
// Start with updates turned off // Start with updates turned off
mUpdatesRequested = false; mUpdatesRequested = false;
// Create the LocationRequest object // Create the LocationRequest object
if (mLocationRequest == null) if (mLocationRequest == null)
mLocationRequest = LocationRequest.create(); mLocationRequest = LocationRequest.create();
onLocationSetInterval(0, 0); onLocationSetInterval(0, 0);
} }
@ -166,7 +166,7 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
*/ */
public void onLocationStart() public void onLocationStart()
{ {
mUpdatesRequested = true; mUpdatesRequested = true;
// Connect the client. // Connect the client.
mLocationClient.connect(); mLocationClient.connect();