use of org.fossasia.openevent.data.Session in project open-event-android by fossasia.
the class OSMapFragment method showEvent.
private void showEvent() {
if (!event.isValid())
return;
try {
int id = SharedPreferencesUtil.getInt(ConstantStrings.SESSION_MAP_ID, -1);
if (id != -1) {
Session session = realmRepo.getSessionSync(id);
Microlocation microlocation = session.getMicrolocation();
if (microlocation.getLatitude() == 0 && microlocation.getLongitude() == 0) {
setDestinationLatitude(event.getLatitude());
setDestinationLongitude(event.getLongitude());
setDestinationName(event.getLocationName());
} else {
setDestinationLatitude(microlocation.getLatitude());
setDestinationLongitude(microlocation.getLongitude());
setDestinationName(microlocation.getName());
}
} else {
setDestinationLatitude(event.getLatitude());
setDestinationLongitude(event.getLongitude());
setDestinationName(event.getLocationName());
}
} catch (Exception e) {
setDestinationLatitude(event.getLatitude());
setDestinationLongitude(event.getLongitude());
setDestinationName(event.getLocationName());
}
}
use of org.fossasia.openevent.data.Session in project open-event-android by fossasia.
the class GlobalSearchAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch(holder.getItemViewType()) {
case TRACK:
TrackViewHolder trackSearchHolder = (TrackViewHolder) holder;
Track currentTrack = (Track) getItem(position);
trackSearchHolder.bindTrack(currentTrack);
break;
case SPEAKER:
SpeakerViewHolder speakerSearchHolder = (SpeakerViewHolder) holder;
Speaker speaker = (Speaker) getItem(position);
speakerSearchHolder.bindSpeaker(speaker);
break;
case LOCATION:
LocationViewHolder locationSearchHolder = (LocationViewHolder) holder;
Microlocation location = (Microlocation) getItem(position);
locationSearchHolder.bindLocation(location);
break;
case DIVIDER:
DividerViewHolder resultTypeViewHolder = (DividerViewHolder) holder;
String headerItem = (String) getItem(position);
resultTypeViewHolder.bindHeader(headerItem);
break;
case SESSION:
DayScheduleViewHolder bookmarkTypeViewHolder = (DayScheduleViewHolder) holder;
Session bookmarkItem = (Session) getItem(position);
bookmarkTypeViewHolder.setSession(bookmarkItem);
bookmarkTypeViewHolder.bindSession(realmRepo);
break;
default:
// If viewType is none of the above then nothing is done
break;
}
}
use of org.fossasia.openevent.data.Session in project open-event-android by fossasia.
the class TrackSessionsActivityViewModel method calculateUpcomingOngoingPosition.
private void calculateUpcomingOngoingPosition(List<Session> sessions) {
int countUpcoming = 0;
int countOngoing = 0;
for (Session trackSession : sessions) {
flag = 0;
ZonedDateTime start = DateConverter.getDate(trackSession.getStartsAt());
ZonedDateTime end = DateConverter.getDate((trackSession.getEndsAt()));
ZonedDateTime current = ZonedDateTime.now();
if (DateService.isOngoingSession(start, end, current)) {
ongoingPosition = countOngoing;
break;
} else if (DateService.isUpcomingSession(start, end, current)) {
upcomingPosition = countUpcoming;
break;
} else
flag += 1;
countUpcoming += 1;
countOngoing += 1;
}
}
Aggregations