[Quick search] added icons
This commit is contained in:
parent
36fb39f42b
commit
532769b49d
1 changed files with 36 additions and 14 deletions
|
@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.City;
|
import net.osmand.data.City;
|
||||||
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.Street;
|
import net.osmand.data.Street;
|
||||||
import net.osmand.osm.AbstractPoiType;
|
import net.osmand.osm.AbstractPoiType;
|
||||||
import net.osmand.osm.PoiCategory;
|
import net.osmand.osm.PoiCategory;
|
||||||
|
@ -12,6 +13,9 @@ import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.activities.search.SearchHistoryFragment;
|
||||||
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
|
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.search.core.SearchResult;
|
import net.osmand.search.core.SearchResult;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -100,11 +104,19 @@ public class SearchListItem {
|
||||||
case LOCATION:
|
case LOCATION:
|
||||||
break;
|
break;
|
||||||
case FAVORITE:
|
case FAVORITE:
|
||||||
break;
|
FavouritePoint fav = (FavouritePoint) searchResult.object;
|
||||||
|
return fav.getCategory().length() == 0 ?
|
||||||
|
app.getString(R.string.shared_string_favorites) : fav.getCategory();
|
||||||
case REGION:
|
case REGION:
|
||||||
break;
|
break;
|
||||||
case RECENT_OBJ:
|
case RECENT_OBJ:
|
||||||
break;
|
HistoryEntry entry = (HistoryEntry) searchResult.object;
|
||||||
|
boolean hasTypeInDescription = !Algorithms.isEmpty(entry.getName().getTypeName());
|
||||||
|
if (hasTypeInDescription) {
|
||||||
|
return entry.getName().getTypeName();
|
||||||
|
} else {
|
||||||
|
return app.getString(R.string.shared_string_history);
|
||||||
|
}
|
||||||
case WPT:
|
case WPT:
|
||||||
break;
|
break;
|
||||||
case UNKNOWN_NAME_FILTER:
|
case UNKNOWN_NAME_FILTER:
|
||||||
|
@ -116,17 +128,21 @@ public class SearchListItem {
|
||||||
public Drawable getIcon() {
|
public Drawable getIcon() {
|
||||||
switch (searchResult.objectType) {
|
switch (searchResult.objectType) {
|
||||||
case CITY:
|
case CITY:
|
||||||
break;
|
return app.getIconsCache().getIcon(R.drawable.ic_action_building_number,
|
||||||
|
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
|
||||||
case VILLAGE:
|
case VILLAGE:
|
||||||
break;
|
return app.getIconsCache().getIcon(R.drawable. ic_action_home_dark,
|
||||||
|
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
|
||||||
case POSTCODE:
|
case POSTCODE:
|
||||||
break;
|
|
||||||
case STREET:
|
case STREET:
|
||||||
break;
|
return app.getIconsCache().getIcon(R.drawable.ic_action_street_name,
|
||||||
|
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
|
||||||
case HOUSE:
|
case HOUSE:
|
||||||
break;
|
return app.getIconsCache().getIcon(R.drawable.ic_action_building,
|
||||||
|
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
|
||||||
case STREET_INTERSECTION:
|
case STREET_INTERSECTION:
|
||||||
break;
|
return app.getIconsCache().getIcon(R.drawable.ic_action_intersection,
|
||||||
|
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
|
||||||
case POI_TYPE:
|
case POI_TYPE:
|
||||||
AbstractPoiType abstractPoiType = (AbstractPoiType) searchResult.object;
|
AbstractPoiType abstractPoiType = (AbstractPoiType) searchResult.object;
|
||||||
if (RenderingIcons.containsBigIcon(abstractPoiType.getIconKeyName())) {
|
if (RenderingIcons.containsBigIcon(abstractPoiType.getIconKeyName())) {
|
||||||
|
@ -155,15 +171,21 @@ public class SearchListItem {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case LOCATION:
|
case LOCATION:
|
||||||
break;
|
return app.getIconsCache().getIcon(R.drawable.ic_action_coordinates_latitude,
|
||||||
|
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
|
||||||
case FAVORITE:
|
case FAVORITE:
|
||||||
break;
|
FavouritePoint fav = (FavouritePoint) searchResult.object;
|
||||||
|
return FavoriteImageDrawable.getOrCreate(app, fav.getColor(), false);
|
||||||
case REGION:
|
case REGION:
|
||||||
break;
|
return app.getIconsCache().getIcon(R.drawable.ic_world_globe_dark,
|
||||||
|
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
|
||||||
case RECENT_OBJ:
|
case RECENT_OBJ:
|
||||||
break;
|
HistoryEntry entry = (HistoryEntry) searchResult.object;
|
||||||
|
return app.getIconsCache().getIcon(SearchHistoryFragment.getItemIcon(entry.getName()),
|
||||||
|
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
|
||||||
case WPT:
|
case WPT:
|
||||||
break;
|
return app.getIconsCache().getIcon(R.drawable.map_action_flag_dark,
|
||||||
|
app.getSettings().isLightContent() ? R.color.osmand_orange : R.color.osmand_orange_dark);
|
||||||
case UNKNOWN_NAME_FILTER:
|
case UNKNOWN_NAME_FILTER:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue