use of de.tum.in.tumcampusapp.component.tumui.roomfinder.model.RoomFinderRoom in project TumCampusApp by TCA-Team.
the class RoomFinderActivity method onSearchFinished.
@Override
protected void onSearchFinished(Optional<List<RoomFinderRoom>> result) {
if (!result.isPresent()) {
if (NetUtils.isConnected(this)) {
showErrorLayout();
} else {
showNoInternetLayout();
}
return;
}
List<RoomFinderRoom> searchResult = result.get();
if (searchResult.isEmpty()) {
list.setAdapter(new NoResultsAdapter(this));
} else {
adapter = new RoomFinderListAdapter(this, searchResult);
list.setAdapter(adapter);
}
showLoadingEnded();
}
use of de.tum.in.tumcampusapp.component.tumui.roomfinder.model.RoomFinderRoom in project TumCampusApp by TCA-Team.
the class RoomFinderListAdapter method getView.
@Override
public View getView(int position, View view, ViewGroup parent) {
ViewHolder holder;
View convertView = view;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.list_roomfinder_item, parent, false);
holder = new ViewHolder();
holder.tvRoomTitle = convertView.findViewById(R.id.startup_actionbar_title);
holder.tvBuildingTitle = convertView.findViewById(R.id.building);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
RoomFinderRoom room = infoList.get(position);
// Setting all values in listView
holder.tvRoomTitle.setText(room.getInfo());
holder.tvBuildingTitle.setText(room.getAddress());
return convertView;
}
use of de.tum.in.tumcampusapp.component.tumui.roomfinder.model.RoomFinderRoom in project TumCampusApp by TCA-Team.
the class BarrierFreeFacilitiesActivity method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
RoomFinderRoom facility = facilities.get(position);
recents.insert(new Recent(facility.toString(), RecentsDao.ROOMS));
// Start detail activity
Intent intent = new Intent(this, RoomFinderDetailsActivity.class);
intent.putExtra(RoomFinderDetailsActivity.EXTRA_ROOM_INFO, facility);
startActivity(intent);
}
use of de.tum.in.tumcampusapp.component.tumui.roomfinder.model.RoomFinderRoom in project TumCampusApp by TCA-Team.
the class BarrierFreeFacilitiesActivity method onLoadInBackground.
@Override
protected Optional<List<RoomFinderRoom>> onLoadInBackground(Void... arg) {
showLoadingStart();
List<RoomFinderRoom> result;
TUMCabeClient cabeClient = TUMCabeClient.getInstance(this);
try {
switch(selectedFacilityPage) {
case 0:
// Nearby staff - need to fetch building id first
Optional<String> buildingId = locationManager.getBuildingIDFromCurrentLocation();
if (buildingId.isPresent()) {
result = cabeClient.getListOfNearbyFacilities(buildingId.get());
} else {
return Optional.absent();
}
break;
case 1:
result = cabeClient.getListOfToilets();
break;
case 2:
result = cabeClient.getListOfElevators();
break;
default:
return Optional.absent();
}
} catch (IOException e) {
Utils.log(e);
return Optional.absent();
}
if (result == null) {
return Optional.absent();
}
return Optional.of(result);
}
use of de.tum.in.tumcampusapp.component.tumui.roomfinder.model.RoomFinderRoom 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