fix list order

This commit is contained in:
sonora 2015-04-14 22:30:20 +02:00
parent 7d1e389b94
commit c5e413d097

View file

@ -258,20 +258,17 @@ public class MapActivityLayers {
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity); final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
adapter.item(R.string.shared_string_search).iconColor(R.drawable.ic_action_search_dark).reg(); adapter.item(R.string.shared_string_search).iconColor(R.drawable.ic_action_search_dark).reg();
final List<PoiLegacyFilter> list = new ArrayList<PoiLegacyFilter>(); final List<PoiLegacyFilter> list = new ArrayList<PoiLegacyFilter>();
list.add(poiFilters.getCustomPOIFilter());
for (PoiLegacyFilter f : poiFilters.getTopDefinedPoiFilters()) { for (PoiLegacyFilter f : poiFilters.getTopDefinedPoiFilters()) {
addFilterToList(adapter, list, f); addFilterToList(adapter, list, f);
} }
list.add(poiFilters.getCustomPOIFilter());
Builder builder = new AlertDialog.Builder(activity); Builder builder = new AlertDialog.Builder(activity);
ListAdapter listAdapter = adapter.createListAdapter(activity, app.getSettings().isLightContent()); ListAdapter listAdapter = adapter.createListAdapter(activity, app.getSettings().isLightContent());
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener(){ builder.setAdapter(listAdapter, new DialogInterface.OnClickListener(){
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
if (which == 0) { PoiLegacyFilter pf = list.get(which);
which = list.size() + 2;
}
PoiLegacyFilter pf = list.get(which - 1);
String filterId = pf.getFilterId(); String filterId = pf.getFilterId();
if(filterId.equals(PoiLegacyFilter.CUSTOM_FILTER_ID)){ if(filterId.equals(PoiLegacyFilter.CUSTOM_FILTER_ID)){
Intent search = new Intent(activity, SearchActivity.class); Intent search = new Intent(activity, SearchActivity.class);