use of cl.smartcities.isci.transportinspector.database.ServiceHelper in project androidApp by InspectorIncognito.
the class BusSearchResultActivity method setRouteLists.
private void setRouteLists(Service service) {
RouteHelper routeHelper = new RouteHelper(this);
ServiceHelper serviceHelper = new ServiceHelper(this);
BusStopHelper busStopHelper = new BusStopHelper(this);
activePoints = routeHelper.getRoute(service.getName(), "I");
if (activePoints == null) {
activePoints = new ArrayList<>();
}
inactivePoints = routeHelper.getRoute(service.getName(), "R");
if (inactivePoints == null) {
inactivePoints = new ArrayList<>();
}
String busStopByService = serviceHelper.getBusStopByService(service.getName(), "I");
if (busStopByService == null || busStopByService.equals("")) {
activeBusStops = new ArrayList<>();
} else {
activeBusStops = busStopHelper.getAllBusStopsIn(busStopByService.split("-"));
}
busStopByService = serviceHelper.getBusStopByService(service.getName(), "R");
if (busStopByService == null || busStopByService.equals("")) {
inactiveBusStops = new ArrayList<>();
} else {
inactiveBusStops = busStopHelper.getAllBusStopsIn(busStopByService.split("-"));
}
}
use of cl.smartcities.isci.transportinspector.database.ServiceHelper in project androidApp by InspectorIncognito.
the class OnBusEngine method setBusStopDrawable.
private void setBusStopDrawable() {
ServiceHelper helper = new ServiceHelper(TranSappApplication.getAppContext());
int colorId = helper.getColorId(bus.getService());
int color = ContextCompat.getColor(TranSappApplication.getAppContext(), Constants.BUS_COLOR.get(colorId));
Drawable iconDrawable = ContextCompat.getDrawable(TranSappApplication.getAppContext(), R.drawable.paradero).mutate();
Bitmap bitmap = MapboxUtil.getBitmapFromDrawable(iconDrawable);
Paint paint = new Paint();
ColorFilter filter = new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY);
paint.setColorFilter(filter);
Bitmap mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(mutableBitmap);
canvas.drawBitmap(mutableBitmap, 0, 0, paint);
mapboxMap.addImage("routeBusIcon", mutableBitmap);
}
Aggregations