Added a possibility to search for a particular user #318

Merged
merged 11 commits into from Jul 30, 2013

Projects

None yet

3 participants

@atermenji

Recently I've tried to search for a concrete GitHub user and found that mobile client lacks this possibility. So I've implemented this by myself.

Since this PR contains a lot of changes I'll try to describe them in details.

UI side

I've changed RepositorySearchActivity to a SearchActivity with a tabbed pager. Now it contains two tabs - repositories and users. "Repositories" tab displays searched repos, same as before, while "Users" tab displays a user with user_login = search_query. Screenshots below:

left

right

Implementation

Currently GitHub Java API lib has no possibility to search users with GitHub Search API.
So I've used UserService.getUser(login) method to find a user that exactly matches search query (better than nothing I guess).

I though about extending UserService class and adding a method there to get users with Search API. This can be done similar to RepositoryService.searchRepositories method.

But Search API does not return any info to get user avatar (avatar_url / gravatar_id / user_email) though it should return gravatar_id as stated in docs. A possible implementation for me is to invoke RefreshUserTask on each list item to retrieve full User model.

I've moved search related classes to ui.search package. Also tried to stick with the existing code style in this PR, hope I have not missed anything.

@kevinsawicki how do you like the idea? Waiting for feedback

@darth10
darth10 commented Feb 6, 2013

👍

@atermenji

Update
It seems that user search API is fixed now and it returns gravatar_id field.
So I can implement a complete user search as suggested earlier.

@atermenji

Update

I've implemented complete user search. Screenshot below:

screenshot

Some implementation details

I've used Github Search API for this.
I had to create a SearchUser class similar to how it is done in GitHub Java API.
Next I've implemented a SearchUserService class. It is an extension to UserService class from GitHub Java API with some methods to search for users.

Also, I've rebased the branch to remove those "formatting fix" commits.

Waiting for feedback on this.

@atermenji

Any updates on this one?

@kevinsawicki
Collaborator

Sorry for the delay, I'll review this soon.

@atermenji atermenji merged commit 3e0b4f2 into pockethub:master Jul 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment