Fix lint errors

pull/384/head
Alex Baker 9 years ago
parent 337822d8ef
commit ed55fcc38c

@ -1,5 +1,6 @@
package org.tasks.location;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@ -50,6 +51,8 @@ public class GeofenceApi {
newClient(new GoogleApi.GoogleApiClientConnectionHandler() {
@Override
public void onConnect(final GoogleApiClient client) {
@SuppressWarnings("ResourceType")
@SuppressLint("MissingPermission")
PendingResult<Status> result = LocationServices.GeofencingApi.addGeofences(
client,
getRequests(geofences),

@ -1,23 +1,15 @@
package org.tasks.location;
import android.content.Context;
import android.location.Location;
import android.os.Bundle;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.places.AutocompletePredictionBuffer;
import com.google.android.gms.location.places.PlaceBuffer;
import com.google.android.gms.location.places.Places;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import org.tasks.injection.ForApplication;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import timber.log.Timber;
@ -40,36 +32,6 @@ public class GoogleApi implements GoogleApiClient.ConnectionCallbacks {
.addConnectionCallbacks(this);
}
public void getPlaceDetails(final String placeId, final ResultCallback<PlaceBuffer> callback) {
Places.GeoDataApi.getPlaceById(googleApiClient, placeId).setResultCallback(new ResultCallback<PlaceBuffer>() {
@Override
public void onResult(PlaceBuffer places) {
callback.onResult(places);
}
});
}
public void getAutocompletePredictions(final String constraint, final ResultCallback<AutocompletePredictionBuffer> callback) {
final LatLngBounds bounds = LatLngBounds.builder().include(getLastKnownLocation(googleApiClient)).build();
Places.GeoDataApi.getAutocompletePredictions(googleApiClient, constraint, bounds, null)
.setResultCallback(new ResultCallback<AutocompletePredictionBuffer>() {
@Override
public void onResult(AutocompletePredictionBuffer autocompletePredictions) {
callback.onResult(autocompletePredictions);
}
}, 15, TimeUnit.SECONDS);
}
private LatLng getLastKnownLocation(GoogleApiClient googleApiClient) {
try {
Location lastLocation = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
return new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
} catch (Exception e) {
Timber.e(e, e.getMessage());
return new LatLng(0, 0);
}
}
public void connect(final GoogleApiClientConnectionHandler googleApiClientConnectionHandler) {
connect(googleApiClientConnectionHandler, new GoogleApiClient.OnConnectionFailedListener() {
@Override
@ -79,15 +41,6 @@ public class GoogleApi implements GoogleApiClient.ConnectionCallbacks {
});
}
public void connect(final GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener) {
connect(new GoogleApiClientConnectionHandler() {
@Override
public void onConnect(GoogleApiClient client) {
Timber.i("onConnect(%s)", client);
}
}, onConnectionFailedListener);
}
private void connect(final GoogleApiClientConnectionHandler googleApiClientConnectionHandler, GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener) {
this.googleApiClientConnectionHandler = googleApiClientConnectionHandler;
googleApiClient = builder
@ -96,10 +49,6 @@ public class GoogleApi implements GoogleApiClient.ConnectionCallbacks {
googleApiClient.connect();
}
public void disconnect() {
googleApiClient.disconnect();
}
@Override
public void onConnected(Bundle bundle) {
Timber.i("onConnected(Bundle)");

@ -291,11 +291,12 @@ public class TaskListFragment extends InjectingListFragment implements SwipeRefr
private void setupRefresh(SwipeRefreshLayout layout) {
layout.setOnRefreshListener(this);
layout.setColorScheme(
R.color.importance_1,
R.color.importance_2,
R.color.importance_3,
R.color.importance_4);
Resources resources = getResources();
layout.setColorSchemeColors(
resources.getColor(R.color.importance_1),
resources.getColor(R.color.importance_2),
resources.getColor(R.color.importance_3),
resources.getColor(R.color.importance_4));
}
@Override

@ -53,7 +53,7 @@ public class VoiceOutputAssistant implements OnInitListener {
mTts.setOnUtteranceCompletedListener(new TextToSpeech.OnUtteranceCompletedListener() {
@Override
public void onUtteranceCompleted(String utteranceId) {
Timber.d("%s: onUtteranceCompleted %s", utteranceId);
Timber.d("%s: onUtteranceCompleted", utteranceId);
if(utteranceId.equals(id)) {
shutdown();
}

Loading…
Cancel
Save