Search in sources :

Example 6 with ServiceHelper

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("-"));
    }
}
Also used : BusStopHelper(cl.smartcities.isci.transportinspector.database.BusStopHelper) RouteHelper(cl.smartcities.isci.transportinspector.database.RouteHelper) ServiceHelper(cl.smartcities.isci.transportinspector.database.ServiceHelper)

Example 7 with ServiceHelper

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);
}
Also used : Bitmap(android.graphics.Bitmap) ColorFilter(android.graphics.ColorFilter) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) Canvas(android.graphics.Canvas) Drawable(android.graphics.drawable.Drawable) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) Paint(android.graphics.Paint) ServiceHelper(cl.smartcities.isci.transportinspector.database.ServiceHelper) Paint(android.graphics.Paint)

Aggregations

ServiceHelper (cl.smartcities.isci.transportinspector.database.ServiceHelper)7 NonNull (android.support.annotation.NonNull)2 Service (cl.smartcities.isci.transportinspector.backend.Service)2 BusStopHelper (cl.smartcities.isci.transportinspector.database.BusStopHelper)2 ArrayList (java.util.ArrayList)2 Bitmap (android.graphics.Bitmap)1 Canvas (android.graphics.Canvas)1 ColorFilter (android.graphics.ColorFilter)1 Paint (android.graphics.Paint)1 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)1 Drawable (android.graphics.drawable.Drawable)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 BusStop (cl.smartcities.isci.transportinspector.backend.BusStop)1 RouteHelper (cl.smartcities.isci.transportinspector.database.RouteHelper)1 OnBusService (cl.smartcities.isci.transportinspector.onBusService.OnBusService)1 Request (cl.smartcities.isci.transportinspector.serverConnection.requests.Request)1 GetUUIDRequest (cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.GetUUIDRequest)1