Search in sources :

Example 46 with User

use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.

the class RepositoryListFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    Activity activity = getActivity();
    User currentOrg = null;
    if (getActivity() instanceof OrganizationSelectionProvider) {
        currentOrg = ((OrganizationSelectionProvider) activity).addListener(this);
    }
    if (getArguments() != null && getArguments().containsKey("org")) {
        currentOrg = getArguments().getParcelable("org");
    }
    if (currentOrg == null && savedInstanceState != null) {
        currentOrg = savedInstanceState.getParcelable(EXTRA_USER);
    }
    org.set(currentOrg);
    if (currentOrg != null) {
        recentRepos = new RecentRepositories(activity, currentOrg);
    }
    setEmptyText(R.string.no_repositories);
    super.onActivityCreated(savedInstanceState);
}
Also used : User(com.meisolsson.githubsdk.model.User) OrganizationSelectionProvider(com.github.pockethub.android.ui.user.OrganizationSelectionProvider) Activity(android.app.Activity) UserViewActivity(com.github.pockethub.android.ui.user.UserViewActivity)

Example 47 with User

use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.

the class RepositoryListFragment method onSaveInstanceState.

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    User org = this.org.get();
    if (org != null) {
        outState.putParcelable(EXTRA_USER, org);
    }
}
Also used : User(com.meisolsson.githubsdk.model.User)

Example 48 with User

use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.

the class GistFragment method isOwner.

private boolean isOwner() {
    if (gist == null) {
        return false;
    }
    User user = gist.owner();
    if (user == null) {
        return false;
    }
    String login = AccountUtils.getLogin(getActivity());
    return login != null && login.equals(user.login());
}
Also used : User(com.meisolsson.githubsdk.model.User)

Example 49 with User

use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.

the class MembersFragment 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 {
            OrganizationMemberService service = ServiceGenerator.createService(getContext(), OrganizationMemberService.class);
            int current = 1;
            int last = -1;
            List<User> users = new ArrayList<>();
            while (current != last) {
                Page<User> page = service.getMembers(org.login(), current).blockingGet();
                users.addAll(page.items());
                last = page.last() != null ? page.last() : -1;
                current = page.next() != null ? page.next() : -1;
            }
            return users;
        }
    };
}
Also used : OrganizationMemberService(com.meisolsson.githubsdk.service.organizations.OrganizationMemberService) User(com.meisolsson.githubsdk.model.User) ArrayList(java.util.ArrayList) ThrowableLoader(com.github.pockethub.android.ThrowableLoader)

Example 50 with User

use of com.meisolsson.githubsdk.model.User in project PocketHub by pockethub.

the class PagedUserFragment method onListItemClick.

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    User user = (User) l.getItemAtPosition(position);
    startActivity(UserViewActivity.createIntent(user));
}
Also used : User(com.meisolsson.githubsdk.model.User)

Aggregations

User (com.meisolsson.githubsdk.model.User)97 Repository (com.meisolsson.githubsdk.model.Repository)15 View (android.view.View)14 Intent (android.content.Intent)13 TextView (android.widget.TextView)11 ImageView (android.widget.ImageView)10 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)10 Label (com.meisolsson.githubsdk.model.Label)9 Milestone (com.meisolsson.githubsdk.model.Milestone)8 Bundle (android.os.Bundle)7 ApiHelpers (com.gh4a.utils.ApiHelpers)7 GitHubEvent (com.meisolsson.githubsdk.model.GitHubEvent)7 UserService (com.meisolsson.githubsdk.service.users.UserService)7 SmallTest (androidx.test.filters.SmallTest)6 List (java.util.List)6 ViewGroup (android.view.ViewGroup)5 AvatarHandler (com.gh4a.utils.AvatarHandler)5 UiUtils (com.gh4a.utils.UiUtils)5 Issue (com.meisolsson.githubsdk.model.Issue)5