Skip to content

Commit

Permalink
#1322 - News items - show and sort by published date
Browse files Browse the repository at this point in the history
  • Loading branch information
budowski committed Jan 19, 2024
1 parent 98e65d0 commit 208828b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 208828b

Please sign in to comment.