[Lint] Remove class variables to local

This commit is contained in:
Dinu Kumarasiri 2017-05-20 11:37:04 +02:00
parent 8f5be5a434
commit 83957bae06
10 changed files with 23 additions and 35 deletions

View file

@ -32,16 +32,15 @@ import fr.free.nrw.commons.theme.NavigationBaseActivity;
import fr.free.nrw.commons.utils.UriSerializer;
import timber.log.Timber;
public class NearbyActivity extends NavigationBaseActivity {
@BindView(R.id.progressBar)
ProgressBar progressBar;
private boolean isMapViewActive = false;
private LocationServiceManager locationManager;
private LatLng curLatLang;
private Gson gson;
private String gsonPlaceList;
private String gsonCurLatLng;
private Bundle bundle;
private NearbyAsyncTask nearbyAsyncTask;
@ -203,11 +202,11 @@ public class NearbyActivity extends NavigationBaseActivity {
return;
}
gson = new GsonBuilder()
Gson gson = new GsonBuilder()
.registerTypeAdapter(Uri.class, new UriSerializer())
.create();
gsonPlaceList = gson.toJson(placeList);
gsonCurLatLng = gson.toJson(curLatLang);
String gsonPlaceList = gson.toJson(placeList);
String gsonCurLatLng = gson.toJson(curLatLang);
if (placeList.size() == 0) {
int duration = Toast.LENGTH_SHORT;

View file

@ -24,9 +24,7 @@ import fr.free.nrw.commons.utils.UriDeserializer;
import timber.log.Timber;
public class NearbyListFragment extends ListFragment {
private Gson gson;
private List<Place> placeList;
private LatLng curLatLng;
@BindView(R.id.listView) ListView listview;
@ -60,7 +58,7 @@ public class NearbyListFragment extends ListFragment {
// Check that this is the first time view is created,
// to avoid double list when screen orientation changed
Bundle bundle = this.getArguments();
gson = new GsonBuilder()
Gson gson = new GsonBuilder()
.registerTypeAdapter(Uri.class, new UriDeserializer())
.create();
if (bundle != null) {
@ -69,7 +67,7 @@ public class NearbyListFragment extends ListFragment {
Type listType = new TypeToken<List<Place>>() {}.getType();
placeList = gson.fromJson(gsonPlaceList, listType);
Type curLatLngType = new TypeToken<LatLng>() {}.getType();
curLatLng = gson.fromJson(gsonLatLng, curLatLngType);
LatLng curLatLng = gson.fromJson(gsonLatLng, curLatLngType);
placeList = NearbyController.loadAttractionsFromLocationToPlaces(curLatLng, placeList);
}
if (savedInstanceState == null) {

View file

@ -31,8 +31,6 @@ import fr.free.nrw.commons.utils.UriDeserializer;
public class NearbyMapFragment extends android.support.v4.app.Fragment {
private MapView mapView;
private Gson gson;
private List<Place> placeList;
private List<NearbyBaseMarker> baseMarkerOptionses;
private fr.free.nrw.commons.location.LatLng curLatLng;
@ -44,14 +42,14 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = this.getArguments();
gson = new GsonBuilder()
Gson gson = new GsonBuilder()
.registerTypeAdapter(Uri.class, new UriDeserializer())
.create();
if (bundle != null) {
String gsonPlaceList = bundle.getString("PlaceList");
String gsonLatLng = bundle.getString("CurLatLng");
Type listType = new TypeToken<List<Place>>() {}.getType();
placeList = gson.fromJson(gsonPlaceList, listType);
List<Place> placeList = gson.fromJson(gsonPlaceList, listType);
Type curLatLngType = new TypeToken<fr.free.nrw.commons.location.LatLng>() {}.getType();
curLatLng = gson.fromJson(gsonLatLng, curLatLngType);
baseMarkerOptionses = NearbyController