use of cl.smartcities.isci.transportinspector.drawables.greenButton.GreenButtonUp in project androidApp by InspectorIncognito.
the class BusStopIconsBuilder method setIconsAndViews.
public void setIconsAndViews(LayoutInflater inflater, HashMap<String, Bitmap> imagesMap, HashMap<String, View> viewMap) {
for (Feature feature : featureCollection.getFeatures()) {
String id = feature.getStringProperty(Marker.PROPERTY_ID);
BusStopMarker marker = (BusStopMarker) feature;
BusStop busStop = marker.getBusStop();
View view = inflater.inflate(R.layout.bus_stop_bubble, null);
TextView code = view.findViewById(R.id.bubble_bus_stop_code);
TextView name = view.findViewById(R.id.bubble_bus_stop_name);
code.setText(id);
name.setText(busStop.getName());
AppCompatImageView favIcon = view.findViewById(R.id.fav_icon);
final FavoriteHelper helper = new FavoriteHelper(view.getContext());
boolean isFavorite = helper.isFavorite(busStop.getId());
if (isFavorite) {
favIcon.setColorFilter(ContextCompat.getColor(view.getContext(), R.color.yellow_fav));
}
List<ServerSentBus> buses = Bus.filterDummyPlates(busStop.getIncomingBuses());
buses = ServerSentBus.orderBusesByDistance(buses);
if (!buses.isEmpty()) {
view.findViewById(R.id.bus_layout).setVisibility(View.VISIBLE);
view.findViewById(R.id.bus_empty_layout).setVisibility(View.GONE);
setupNearBusLayout(view, getNearestVisibleBus(buses, busStop));
} else {
view.findViewById(R.id.bus_layout).setVisibility(View.GONE);
view.findViewById(R.id.bus_empty_layout).setVisibility(View.VISIBLE);
}
setEventLayout(view, marker.getEvents());
Bitmap bitmap = GenerateViewIconTask.SymbolGenerator.generate(view);
imagesMap.put(id + "-max", bitmap);
viewMap.put("busStop-max", view);
View viewMin = inflater.inflate(R.layout.bus_stop_minimize_bubble, null);
TextView nameMin = viewMin.findViewById(R.id.bubble_bus_stop_code);
nameMin.setText(id);
((ImageView) viewMin.findViewById(R.id.maximize)).setImageDrawable(new GreenButtonUp(viewMin.getContext()));
imagesMap.put(id + "-min", GenerateViewIconTask.SymbolGenerator.generate(viewMin));
viewMap.put("busStop-min", viewMin);
}
}
Aggregations