slighly refactor SearchHistoryFragment to debug missing distance update when origin is chenged

This commit is contained in:
sonora 2014-12-30 10:51:54 +01:00
parent 91ba848d07
commit 359b042574

View file

@ -97,7 +97,9 @@ public class SearchHistoryFragment extends SherlockListFragment implements Sear
public void locationUpdate(LatLon l) {
location = l;
if(historyAdapter != null) {
historyAdapter.notifyDataSetChanged();
//historyAdapter.notifyDataSetChanged();
//This did not update distances when origin was changed, try this:
historyAdapter.updateLocation(l);
}
}
@ -126,6 +128,11 @@ public class SearchHistoryFragment extends SherlockListFragment implements Sear
class HistoryAdapter extends ArrayAdapter<HistoryEntry> {
public void updateLocation(LatLon l) {
location = l;
notifyDataSetChanged();
}
public HistoryAdapter(List<HistoryEntry> list) {
super(getActivity(), R.layout.search_history_list_item, list);
}