use of org.threeten.bp.format.DateTimeParseException in project open-event-orga-app by fossasia.
the class CreateTicketPresenter method verify.
private boolean verify() {
try {
ZonedDateTime start = DateUtils.getDate(ticket.getSalesStartsAt().get());
ZonedDateTime end = DateUtils.getDate(ticket.getSalesEndsAt().get());
if (!end.isAfter(start)) {
getView().showError("End time should be after start time");
return false;
}
if (ticket.minOrder != null && ticket.maxOrder != null && ticket.minOrder > ticket.maxOrder) {
getView().showError("Minimum order should be greater than Maximum order");
return false;
}
return true;
} catch (DateTimeParseException pe) {
getView().showError("Please enter date in correct format");
return false;
}
}
use of org.threeten.bp.format.DateTimeParseException in project open-event-orga-app by fossasia.
the class CreateEventPresenter method verify.
private boolean verify() {
try {
ZonedDateTime start = DateUtils.getDate(event.getStartsAt().get());
ZonedDateTime end = DateUtils.getDate(event.getEndsAt().get());
if (!end.isAfter(start)) {
getView().showError("End time should be after start time");
return false;
}
return true;
} catch (DateTimeParseException pe) {
getView().showError("Please enter date in correct format");
return false;
}
}
use of org.threeten.bp.format.DateTimeParseException in project open-event-android by fossasia.
the class TwitterFeedAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RecyclerViewHolder holder, int position) {
final TwitterFeedItem feedItem = twitterFeedItems.get(position);
String createdTime = feedItem.getCreatedAt();
try {
holder.timeStamp.setText(DateConverter.getRelativeTimeFromUTCTimeStamp(createdTime));
} catch (DateTimeParseException e) {
Timber.e(e);
}
if (!TextUtils.isEmpty(feedItem.getText())) {
holder.statusMsg.setText(feedItem.getText());
holder.statusMsg.setVisibility(View.VISIBLE);
} else {
// status is empty, remove from view
holder.statusMsg.setVisibility(View.GONE);
}
// Checking for null feed url
if (feedItem.getLink() != null) {
holder.url.setText(Html.fromHtml("<a href=\"" + feedItem.getLink() + "\">" + feedItem.getLink() + "</a> "));
// Making url clickable
holder.url.setOnClickListener(view -> Utils.setUpCustomTab(context, feedItem.getLink()));
holder.url.setVisibility(View.VISIBLE);
} else {
// url is null, remove from the view
holder.url.setVisibility(View.GONE);
}
if (feedItem.getImages().size() > 0) {
// In case of more than one image show the first.
String feedImageUri = Utils.parseImageUri(feedItem.getImages().get(0));
Drawable placeholder = VectorDrawableCompat.create(context.getResources(), R.drawable.ic_placeholder_24dp, null);
holder.feedImageView.setVisibility(View.VISIBLE);
Picasso.with(holder.feedImageView.getContext()).load(Uri.parse(feedImageUri)).placeholder(placeholder).into(holder.feedImageView);
} else {
holder.feedImageView.setVisibility(View.GONE);
}
}
use of org.threeten.bp.format.DateTimeParseException in project open-event-android by fossasia.
the class NotificationsAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RecyclerViewHolder holder, int position) {
final Notification notificationItem = notificationsList.get(position);
holder.title.setText(notificationItem.getTitle());
holder.message.setText(Views.fromHtml(notificationItem.getMessage()));
// making links in the message clickable.
holder.message.setMovementMethod(LinkMovementMethod.getInstance());
String receivedAt = notificationItem.getReceivedAt();
try {
holder.receivedAt.setText(AndroidDateConverter.getRelativeTimeFromOffsetDateTime(receivedAt));
} catch (DateTimeParseException e) {
Timber.e(e);
}
}
use of org.threeten.bp.format.DateTimeParseException in project open-event-android by fossasia.
the class AboutFragmentViewModel method getSessionsList.
private List<Object> getSessionsList(List<Session> bookmarked) {
List<Object> sessionsList = new ArrayList<>();
for (String eventDate : getDateList()) {
boolean headerCheck = false;
for (Session bookmarkedSession : bookmarked) {
if (bookmarkedSession.getStartDate() != null && bookmarkedSession.getStartDate().equals(eventDate)) {
if (!headerCheck) {
String headerDate = "Invalid";
try {
headerDate = DateConverter.formatDay(eventDate);
} catch (DateTimeParseException e) {
e.printStackTrace();
}
sessionsList.add(headerDate);
headerCheck = true;
}
sessionsList.add(bookmarkedSession);
}
}
}
return sessionsList;
}
Aggregations