mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Merge pull request #512 from veyndan/scope
Reduce scope of places field
This commit is contained in:
commit
fe41169bd6
1 changed files with 5 additions and 8 deletions
|
|
@ -40,8 +40,6 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
|
|||
|
||||
private boolean isTaskRunning = false;
|
||||
|
||||
private List<Place> places;
|
||||
|
||||
private static final String TAG = NearbyListFragment.class.getName();
|
||||
|
||||
public NearbyListFragment() {
|
||||
|
|
@ -145,15 +143,14 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
|
|||
|
||||
@Override
|
||||
protected List<Place> doInBackground(Void... params) {
|
||||
places = loadAttractionsFromLocation(
|
||||
return loadAttractionsFromLocation(
|
||||
((NearbyActivity)getActivity()).getLocationManager().getLatestLocation()
|
||||
);
|
||||
return places;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Place> result) {
|
||||
super.onPostExecute(result);
|
||||
protected void onPostExecute(List<Place> places) {
|
||||
super.onPostExecute(places);
|
||||
|
||||
if (isCancelled()) {
|
||||
return;
|
||||
|
|
@ -164,14 +161,14 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
|
|||
|
||||
listview.setAdapter(adapter);
|
||||
|
||||
listener.onTaskFinished(result);
|
||||
listener.onTaskFinished(places);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@OnItemClick(R.id.listview)
|
||||
void onItemClicked(int position) {
|
||||
Place place = places.get(position);
|
||||
Place place = (Place) listview.getItemAtPosition(position);
|
||||
LatLng placeLatLng = place.location;
|
||||
|
||||
double latitude = placeLatLng.latitude;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue