Search in sources :

Example 1 with UserPair

use of com.github.pockethub.android.core.user.UserEventMatcher.UserPair in project PocketHub by pockethub.

the class NewsFragment method onListItemClick.

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    GitHubEvent event = (GitHubEvent) l.getItemAtPosition(position);
    if (DownloadEvent.equals(event.type())) {
        openDownload(event);
        return;
    }
    if (PushEvent.equals(event.type())) {
        openPush(event);
        return;
    }
    if (CommitCommentEvent.equals(event.type())) {
        openCommitComment(event);
        return;
    }
    Issue issue = issueMatcher.getIssue(event);
    if (issue != null) {
        Repository repo = ConvertUtils.eventRepoToRepo(event.repo());
        viewIssue(issue, repo);
        return;
    }
    Gist gist = gistMatcher.getGist(event);
    if (gist != null) {
        startActivity(GistsViewActivity.createIntent(gist));
        return;
    }
    Repository repo = repoMatcher.getRepository(event);
    if (repo != null) {
        viewRepository(repo);
    }
    UserPair users = userMatcher.getUsers(event);
    if (users != null) {
        viewUser(users);
    }
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) Gist(com.meisolsson.githubsdk.model.Gist) Issue(com.meisolsson.githubsdk.model.Issue) UserPair(com.github.pockethub.android.core.user.UserEventMatcher.UserPair) GitHubEvent(com.meisolsson.githubsdk.model.GitHubEvent)

Example 2 with UserPair

use of com.github.pockethub.android.core.user.UserEventMatcher.UserPair in project PocketHub by pockethub.

the class NewsFragment method onItemClick.

@Override
public void onItemClick(@NonNull Item item, @NonNull View view) {
    if (!(item instanceof NewsItem)) {
        return;
    }
    GitHubEvent event = ((NewsItem) item).getGitHubEvent();
    if (DownloadEvent.equals(event.type())) {
        openDownload(event);
        return;
    }
    if (PushEvent.equals(event.type())) {
        openPush(event);
        return;
    }
    if (CommitCommentEvent.equals(event.type())) {
        openCommitComment(event);
        return;
    }
    Issue issue = IssueEventMatcher.getIssue(event);
    if (issue != null) {
        Repository repo = ConvertUtils.eventRepoToRepo(event.repo());
        viewIssue(issue, repo);
        return;
    }
    Gist gist = GistEventMatcher.getGist(event);
    if (gist != null) {
        startActivity(GistsViewActivity.createIntent(gist));
        return;
    }
    Repository repo = RepositoryEventMatcher.getRepository(event);
    if (repo != null) {
        viewRepository(repo);
    }
    UserPair users = UserEventMatcher.getUsers(event);
    if (users != null) {
        viewUser(users);
    }
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) Gist(com.meisolsson.githubsdk.model.Gist) Issue(com.meisolsson.githubsdk.model.Issue) UserPair(com.github.pockethub.android.core.user.UserEventMatcher.UserPair) GitHubEvent(com.meisolsson.githubsdk.model.GitHubEvent) NewsItem(com.github.pockethub.android.ui.item.news.NewsItem)

Aggregations

UserPair (com.github.pockethub.android.core.user.UserEventMatcher.UserPair)2 Gist (com.meisolsson.githubsdk.model.Gist)2 GitHubEvent (com.meisolsson.githubsdk.model.GitHubEvent)2 Issue (com.meisolsson.githubsdk.model.Issue)2 Repository (com.meisolsson.githubsdk.model.Repository)2 NewsItem (com.github.pockethub.android.ui.item.news.NewsItem)1