use of de.tum.in.tumcampusapp.component.ui.cafeteria.CafeteriaMenuCard in project TumCampusApp by TCA-Team.
the class CafeteriaManager method onRequestCard.
/**
* Shows card for the best matching cafeteria.
*
* @param context Context
* @see LocationManager#getCafeteria()
*/
@Override
public void onRequestCard(Context context) {
// Choose which mensa should be shown
int cafeteriaId = new LocationManager(context).getCafeteria();
if (cafeteriaId == -1) {
return;
}
CafeteriaMenuCard card = new CafeteriaMenuCard(context);
compositeDisposable.add(createCafeteriaObservable(cafeteriaId).take(1).subscribe(cafeteria -> {
card.setCardMenus(cafeteria.id, cafeteria.name, cafeteria.dateStr, de.tum.in.tumcampusapp.utils.DateUtils.getDate(cafeteria.dateStr), cafeteria.menus);
card.apply();
}, throwable -> Utils.log(throwable.getMessage())));
}
Aggregations