From 8fe4ccfe44e19224c498acd7cc434cd04380b929 Mon Sep 17 00:00:00 2001 From: Apostolof Date: Mon, 6 Nov 2017 11:16:53 +0200 Subject: [PATCH] Time fix for 12h users --- .../mthmmy/activities/main/recent/RecentFragment.java | 10 +++++----- .../mthmmy/activities/main/unread/UnreadFragment.java | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java index b9ccb7b8..10166c30 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java @@ -167,11 +167,11 @@ public class RecentFragment extends BaseFragment { matcher = pattern.matcher(dateTime); if (matcher.find()) { dateTime = matcher.group(1); - dateTime=dateTime.substring(0,dateTime.lastIndexOf(":")); - if(!dateTime.contains(",")) - dateTime=dateTime.substring(dateTime.lastIndexOf(" ")+1); - } - else + dateTime = dateTime.replaceAll(":[0-5][0-9] ", " "); + if (!dateTime.contains(",")) { + dateTime = dateTime.replaceAll(".+? ([0-9])", "$1"); + } + } else throw new ParseException("Parsing failed (dateTime)"); topicSummaries.add(new TopicSummary(link, title, lastUser, dateTime)); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java index ee420732..0141f646 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java @@ -174,9 +174,10 @@ public class UnreadFragment extends BaseFragment { dateTime = dateTime.substring(0, dateTime.indexOf("
")); dateTime = dateTime.replace("", ""); dateTime = dateTime.replace("", ""); - dateTime=dateTime.substring(0,dateTime.lastIndexOf(":")); - if(!dateTime.contains(",")) - dateTime=dateTime.substring(dateTime.lastIndexOf(" ")+1); + dateTime = dateTime.replaceAll(":[0-5][0-9] ", " "); + if (!dateTime.contains(",")) { + dateTime = dateTime.replaceAll(".+? ([0-9])", "$1"); + } topicSummaries.add(new TopicSummary(link, title, lastUser, dateTime)); }