Dropdown items are now sorted fixes #1890

This commit is contained in:
GaidamakUA 2015-11-10 11:41:37 +02:00
parent 5ffcfa67d7
commit 2ad8d916ca
2 changed files with 9 additions and 0 deletions

View file

@ -279,12 +279,14 @@ public class AdvancedEditPoiFragment extends Fragment
public void setTagData(String[] tags) {
tagAdapter.clear();
tagAdapter.addAll(tags);
tagAdapter.sort(String.CASE_INSENSITIVE_ORDER);
tagAdapter.notifyDataSetChanged();
}
public void setValueData(String[] values) {
valueAdapter.clear();
valueAdapter.addAll(values);
valueAdapter.sort(String.CASE_INSENSITIVE_ORDER);
valueAdapter.notifyDataSetChanged();
}
}

View file

@ -65,6 +65,7 @@ import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import java.io.Serializable;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -467,6 +468,12 @@ public class EditPoiDialogFragment extends DialogFragment {
}
};
}
adapter.sort(new Comparator<Object>() {
@Override
public int compare(Object lhs, Object rhs) {
return lhs.toString().compareTo(rhs.toString());
}
});
poiTypeEditText.setAdapter(adapter);
poiTypeEditText.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {