use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class CommitUtils method getCommitter.
/**
* Get committer of commit
* <p>
* This checks both the {@link Commit} and the underlying
* {@link Commit} to retrieve a name
*
* @param commit
* @return committer name or null if missing
*/
public static String getCommitter(final Commit commit) {
User committer = commit.committer();
if (committer != null) {
return committer.login();
}
GitCommit rawCommit = commit.commit();
if (rawCommit == null) {
return null;
}
GitUser commitCommitter = rawCommit.committer();
return commitCommitter != null ? commitCommitter.name() : null;
}
use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class UserUriMatcherTest method testUriWithTrailingSlashes.
/**
* Verify URI with name
*/
public void testUriWithTrailingSlashes() {
User user = UserUriMatcher.getUser(Uri.parse("http://github.com/defunkt//"));
assertNotNull(user);
assertEquals("defunkt", user.login());
}
use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class UserUriMatcherTest method testUriWithTrailingSlash.
/**
* Verify URI with name
*/
public void testUriWithTrailingSlash() {
User user = UserUriMatcher.getUser(Uri.parse("http://github.com/defunkt/"));
assertNotNull(user);
assertEquals("defunkt", user.login());
}
use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class RepositoryContributorsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_repo_contributors);
repository = getParcelableExtra(EXTRA_REPOSITORY);
setSupportActionBar((android.support.v7.widget.Toolbar) findViewById(R.id.toolbar));
ActionBar actionBar = getSupportActionBar();
actionBar.setTitle(repository.name());
actionBar.setSubtitle(R.string.contributors);
actionBar.setDisplayHomeAsUpEnabled(true);
User owner = repository.owner();
avatars.bind(getSupportActionBar(), owner);
}
use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.
the class RepositoryContributorsFragment method onCreateLoader.
@Override
public Loader<List<User>> onCreateLoader(int id, Bundle args) {
return new ThrowableLoader<List<User>>(getActivity(), items) {
@Override
public List<User> loadData() throws Exception {
RepositoryService service = ServiceGenerator.createService(getActivity(), RepositoryService.class);
int current = 1;
int last = 0;
List<User> users = new ArrayList<>();
while (current != last) {
Page<User> page = service.getContributors(repo.owner().login(), repo.name(), current).blockingGet();
users.addAll(page.items());
last = page.last() != null ? page.last() : -1;
current = page.next() != null ? page.next() : -1;
}
return users;
}
};
}
Aggregations