From 208828b442015607c1c6a613384cf2967d0d1c1d Mon Sep 17 00:00:00 2001 From: Yaron Budowski Date: Fri, 19 Jan 2024 13:18:48 -0600 Subject: [PATCH] #1322 - News items - show and sort by published date --- .../java/org/inaturalist/android/ProjectNewsAdapter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iNaturalist/src/main/java/org/inaturalist/android/ProjectNewsAdapter.java b/iNaturalist/src/main/java/org/inaturalist/android/ProjectNewsAdapter.java index e1276a2a6..dfdb7ed73 100644 --- a/iNaturalist/src/main/java/org/inaturalist/android/ProjectNewsAdapter.java +++ b/iNaturalist/src/main/java/org/inaturalist/android/ProjectNewsAdapter.java @@ -4,6 +4,7 @@ import android.content.Context; import android.graphics.Bitmap; import android.text.Html; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -43,7 +44,7 @@ public int compare(JSONObject news1, JSONObject news2) { BetterJSONObject news1json = new BetterJSONObject(news1); BetterJSONObject news2json = new BetterJSONObject(news2); - return news2json.getTimestamp("updated_at").compareTo(news1json.getTimestamp("updated_at")); + return news2json.getTimestamp("published_at").compareTo(news1json.getTimestamp("published_at")); } }); mProject = project; @@ -82,7 +83,7 @@ public View getView(int position, View convertView, ViewGroup parent) { String noHTMLDescription = newsContent.getText().toString(); newsContent.setText(noHTMLDescription.replaceAll("[\\xa0]+", "").trim()); // Strip all HTML/Markdown formatting in the preview text BetterJSONObject newsItem = new BetterJSONObject(item); - newsDate.setText(CommentsIdsAdapter.formatIdDate(mContext, newsItem.getTimestamp("updated_at"))); + newsDate.setText(CommentsIdsAdapter.formatIdDate(mContext, newsItem.getTimestamp("published_at"))); if (firstPhotoUrl != null) { // Set the article photo