use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class RepositoryListFragment method onCreateLoader.
@Override
public Loader<List<Repository>> onCreateLoader(int id, final Bundle args) {
return new ThrowableLoader<List<Repository>>(getActivity(), items) {
@Override
public List<Repository> loadData() throws Exception {
User org = RepositoryListFragment.this.org.get();
if (org == null) {
return Collections.emptyList();
}
List<Repository> repos = cache.getRepos(org, isForceRefresh(args));
Collections.sort(repos, recentRepos);
updateHeaders(repos);
return repos;
}
};
}
use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class RepositoryListFragment method onOrganizationSelected.
@Override
public void onOrganizationSelected(final User organization) {
User previousOrg = org.get();
int previousOrgId = previousOrg != null ? previousOrg.id() : -1;
org.set(organization);
if (recentRepos != null) {
recentRepos.saveAsync();
}
// Only hard refresh if view already created and org is changing
if (previousOrgId != organization.id()) {
Activity activity = getActivity();
if (activity != null) {
recentRepos = new RecentRepositories(activity, organization);
}
refreshWithProgress();
}
}
use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class MainActivityTest method setup.
@Before
public void setup() {
mockMainActivity = Robolectric.buildActivity(MockMainActivity.class).create().get();
List<User> org = new ArrayList<>();
org.add(User.builder().build());
Account firstGitHubAccount = new Account("GitHubAccount", "com.github");
Account secondGitHubAccount = new Account("GitHubAccount2", "com.github");
accounts = new Account[] { firstGitHubAccount, secondGitHubAccount };
mockManager = mock(AccountManager.class);
when(mockManager.getAccountsByType(RuntimeEnvironment.application.getString(R.string.account_type))).thenReturn(accounts);
mockMainActivity.onLoadFinished(null, org);
argumentCaptor = ArgumentCaptor.forClass(Account.class);
}
use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class IssuesFragment method updateFilterSummary.
private void updateFilterSummary() {
if (filter.isOpen()) {
state.setText(R.string.open_issues);
} else {
state.setText(R.string.closed_issues);
}
Collection<Label> filterLabels = filter.getLabels();
if (filterLabels != null && !filterLabels.isEmpty()) {
LabelDrawableSpan.setText(labels, filterLabels);
labels.setVisibility(VISIBLE);
} else {
labels.setVisibility(GONE);
}
Milestone filterMilestone = filter.getMilestone();
if (filterMilestone != null) {
milestone.setText(filterMilestone.title());
milestone.setVisibility(VISIBLE);
} else {
milestone.setVisibility(GONE);
}
User user = filter.getAssignee();
if (user != null) {
avatars.bind(assigneeAvatar, user);
assignee.setText(user.login());
assigneeArea.setVisibility(VISIBLE);
} else {
assigneeArea.setVisibility(GONE);
}
}
use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class MembersFragment method onListItemClick.
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
User user = (User) l.getItemAtPosition(position);
startActivity(UserViewActivity.createIntent(user));
}
Aggregations