Item click listener for listview

This commit is contained in:
maskara 2017-04-02 15:32:08 +05:30
parent c2ccd95089
commit 9e4cc80ceb

View file

@ -23,6 +23,7 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnItemClick;
import fr.free.nrw.commons.R; import fr.free.nrw.commons.R;
import fr.free.nrw.commons.utils.ResourceUtils; import fr.free.nrw.commons.utils.ResourceUtils;
@ -164,10 +165,12 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
listview.setAdapter(mAdapter); listview.setAdapter(mAdapter);
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { listener.onTaskFinished(result);
@Override mAdapter.notifyDataSetChanged();
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { }
}
@OnItemClick(R.id.listview) void onItemClicked(int position) {
Place place = places.get(position); Place place = places.get(position);
LatLng placeLatLng = place.location; LatLng placeLatLng = place.location;
@ -184,11 +187,6 @@ public class NearbyListFragment extends ListFragment implements TaskListener {
startActivity(mapIntent); startActivity(mapIntent);
} }
} }
});
listener.onTaskFinished(result);
mAdapter.notifyDataSetChanged();
}
}
private List<Place> loadAttractionsFromLocation(final LatLng curLatLng) { private List<Place> loadAttractionsFromLocation(final LatLng curLatLng) {