diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadAdapter.java index 6afd09c4..d3095800 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadAdapter.java @@ -37,16 +37,16 @@ class UnreadAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, final int position) { - TopicSummary topicSummary = unreadList.get(holder.getAdapterPosition()); + TopicSummary topicSummary = unreadList.get(holder.getBindingAdapterPosition()); final UnreadAdapter.ViewHolder viewHolder = (UnreadAdapter.ViewHolder) holder; viewHolder.mTitleView.setText(topicSummary.getSubject()); if (BaseApplication.getInstance().isDisplayRelativeTimeEnabled()) { String timestamp = topicSummary.getLastPostTimestamp(); try { - viewHolder.mDateTimeView.setReferenceTime(Long.valueOf(timestamp)); + viewHolder.mDateTimeView.setReferenceTime(Long.parseLong(timestamp)); } catch (NumberFormatException e) { - Timber.e(e, "Invalid number format: %s", timestamp); + Timber.e(e, "Invalid number format \"%s\" for %s", timestamp, topicSummary.getTopicUrl()); viewHolder.mDateTimeView.setText(topicSummary.getLastPostSimplifiedDateTime()); } } diff --git a/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java b/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java index 282e2247..0b47cb42 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java +++ b/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java @@ -184,10 +184,8 @@ public class ThmmyPage { public static String getTopicId(String topicUrl) { if (resolvePageCategory(Uri.parse(topicUrl)) == PageCategory.TOPIC) { Matcher topicIdMatcher = Pattern.compile("topic=[0-9]+").matcher(topicUrl); - if (topicIdMatcher.find()) { + if (topicIdMatcher.find()) return topicUrl.substring(topicIdMatcher.start() + 6, topicIdMatcher.end()); - } - else return null; } return null; }