Update icons

This commit is contained in:
Victor Shcherb 2013-07-07 11:28:06 +02:00
parent 905f312818
commit 98ba2a7b40
8 changed files with 38 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -19,6 +19,7 @@ import net.osmand.data.AmenityType;
import net.osmand.map.ITileSource;
import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.Item;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
@ -34,6 +35,7 @@ import net.osmand.plus.R;
import net.osmand.plus.SQLiteTileSource;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.render.MapVectorLayer;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.ContextMenuLayer;
import net.osmand.plus.views.FavoritesLayer;
@ -530,21 +532,43 @@ public class MapActivityLayers {
private void selectPOIFilterLayer(final OsmandMapTileView mapView){
final List<PoiFilter> userDefined = new ArrayList<PoiFilter>();
List<String> list = new ArrayList<String>();
list.add(getString(R.string.any_poi));
OsmandApplication app = (OsmandApplication)getApplication();
final PoiFiltersHelper poiFilters = app.getPoiFilters();
final ContextMenuAdapter adapter = new ContextMenuAdapter(activity);
Item is = adapter.item(getString(R.string.any_poi));
if(RenderingIcons.containsBigIcon("null")) {
is.icon(RenderingIcons.getBigIconResourceId("null"));
}
is.reg();
final PoiFiltersHelper poiFilters = ((OsmandApplication)getApplication()).getPoiFilters();
for (PoiFilter f : poiFilters.getUserDefinedPoiFilters()) {
if(!f.getFilterId().equals(PoiFilter.BY_NAME_FILTER_ID)){
Item it = adapter.item(f.getName());
if(RenderingIcons.containsBigIcon(f.getSimplifiedId())) {
it.icon(RenderingIcons.getBigIconResourceId(f.getSimplifiedId()));
}
it.reg();
userDefined.add(f);
list.add(f.getName());
}
}
for(AmenityType t : AmenityType.values()){
list.add(OsmAndFormatter.toPublicString(t, activity.getMyApplication()));
Item it = adapter.item(OsmAndFormatter.toPublicString(t, activity.getMyApplication()));
if(RenderingIcons.containsBigIcon(t.toString().toLowerCase())) {
it.icon(RenderingIcons.getBigIconResourceId(t.toString().toLowerCase()));
}
it.reg();
}
Builder builder = new AlertDialog.Builder(activity);
builder.setItems(list.toArray(new String[list.size()]), new DialogInterface.OnClickListener(){
ListAdapter listAdapter ;
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
listAdapter =
adapter.createListAdapter(activity, R.layout.list_menu_item, app.getSettings().isLightContentMenu());
} else {
listAdapter =
adapter.createListAdapter(activity, R.layout.list_menu_item_native, app.getSettings().isLightContentMenu());
}
builder.setAdapter(listAdapter, new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {

View file

@ -62,6 +62,14 @@ public class RenderingIcons {
}
}
public static int getBigIconResourceId(String s) {
Integer i = bigIcons.get(s);
if (i == null) {
return 0;
}
return i;
}
public static Drawable getBigIcon(Context ctx, String s) {
Integer resId = bigIcons.get(s);
if (resId != null) {