<commit_before>package com.gh4a.loader;

import java.io.IOException;
import java.util.List;

import org.eclipse.egit.github.core.Release;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.service.RepositoryService;

import android.content.Context;

import com.gh4a.Gh4Application;

public class ReleaseLoader extends BaseLoader<List<Release>> {

    private String mRepoOwner;
    private String mRepoName;

    public ReleaseLoader(Context context, String repoOwner, String repoName) {
        super(context);
        mRepoOwner = repoOwner;
        mRepoName = repoName;
    }

    @Override
    public List<Release> doLoadInBackground() throws IOException {
        RepositoryService repoService = (RepositoryService)
                Gh4Application.get(getContext()).getService(Gh4Application.REPO_SERVICE);
        return repoService.getReleases(new RepositoryId(mRepoOwner, mRepoName));
    }
}<commit_msg>Fix #171. Sort releases by latest.<commit_after>package com.gh4a.loader;

import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import org.eclipse.egit.github.core.Release;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.service.RepositoryService;

import android.content.Context;

import com.gh4a.Gh4Application;

public class ReleaseLoader extends BaseLoader<List<Release>> {

    private String mRepoOwner;
    private String mRepoName;

    public ReleaseLoader(Context context, String repoOwner, String repoName) {
        super(context);
        mRepoOwner = repoOwner;
        mRepoName = repoName;
    }

    @Override
    public List<Release> doLoadInBackground() throws IOException {
        RepositoryService repoService = (RepositoryService)
                Gh4Application.get(getContext()).getService(Gh4Application.REPO_SERVICE);
        List<Release> releases = repoService.getReleases(new RepositoryId(mRepoOwner, mRepoName));
        Collections.sort(releases, new Comparator<Release>() {

            @Override
            public int compare(Release lhs, Release rhs) {
                return rhs.getCreatedAt().compareTo(lhs.getCreatedAt());
            }
            
        });
        return releases;
    }
}
{'fraction_non_alphanumeric': 0.09234828496042216, 'fraction_numerical': 0.005716798592788039, 'mean_word_length': 3.586693548387097, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6186996', 'n_tokens_mistral': 638, 'n_tokens_neox': 633, 'n_words': 130}