use of de.tum.in.tumcampusapp.component.other.general.model.Recent in project TumCampusApp by TCA-Team.
the class TransportationDetailsActivity method onLoadInBackground.
/**
* Load departure times
*
* @param arg Station name
* @return List of departures
*/
@Override
protected List<Departure> onLoadInBackground(String... arg) {
final String location = arg[0];
final String locationID = arg[1];
// Quality is always 100% hit
final StationResult stationResult = new StationResult(location, locationID, Integer.MAX_VALUE);
final String jsonStationResult = gson.toJson(stationResult);
// save clicked station into db
recentsDao.insert(new Recent(jsonStationResult, RecentsDao.STATIONS));
// Check for internet connectivity
if (!NetUtils.isConnected(this)) {
showNoInternetLayout();
return null;
}
// get departures from website
List<Departure> departures = TransportController.getDeparturesFromExternal(this, locationID);
if (departures.isEmpty()) {
showError(R.string.no_departures_found);
}
return departures;
}
use of de.tum.in.tumcampusapp.component.other.general.model.Recent in project TumCampusApp by TCA-Team.
the class RoomFinderActivity method getRecents.
/**
* Reconstruct recents from String
*/
private List<RoomFinderRoom> getRecents() {
List<Recent> recentList = recentsDao.getAll(RecentsDao.ROOMS);
List<RoomFinderRoom> roomList = new ArrayList<>(recentList.size());
for (Recent r : recentList) {
try {
roomList.add(RoomFinderRoom.Companion.fromRecent(r));
} catch (IllegalArgumentException ignore) {
}
}
return roomList;
}
Aggregations