mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Merge remote-tracking branch 'refs/remotes/commons-app/master'
This commit is contained in:
commit
f44cc33b73
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 boolean isTaskRunning = false;
|
||||||
|
|
||||||
private List<Place> places;
|
|
||||||
|
|
||||||
private static final String TAG = NearbyListFragment.class.getName();
|
private static final String TAG = NearbyListFragment.class.getName();
|
||||||
|
|
||||||
public NearbyListFragment() {
|
public NearbyListFragment() {
|
||||||
|
|
@ -145,15 +143,14 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Place> doInBackground(Void... params) {
|
protected List<Place> doInBackground(Void... params) {
|
||||||
places = loadAttractionsFromLocation(
|
return loadAttractionsFromLocation(
|
||||||
((NearbyActivity)getActivity()).getLocationManager().getLatestLocation()
|
((NearbyActivity)getActivity()).getLocationManager().getLatestLocation()
|
||||||
);
|
);
|
||||||
return places;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(List<Place> result) {
|
protected void onPostExecute(List<Place> places) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(places);
|
||||||
|
|
||||||
if (isCancelled()) {
|
if (isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -164,14 +161,14 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
|
||||||
|
|
||||||
listview.setAdapter(adapter);
|
listview.setAdapter(adapter);
|
||||||
|
|
||||||
listener.onTaskFinished(result);
|
listener.onTaskFinished(places);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnItemClick(R.id.listview)
|
@OnItemClick(R.id.listview)
|
||||||
void onItemClicked(int position) {
|
void onItemClicked(int position) {
|
||||||
Place place = places.get(position);
|
Place place = (Place) listview.getItemAtPosition(position);
|
||||||
LatLng placeLatLng = place.location;
|
LatLng placeLatLng = place.location;
|
||||||
|
|
||||||
double latitude = placeLatLng.latitude;
|
double latitude = placeLatLng.latitude;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue