Search in sources :

Example 91 with User

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

the class UserNewsFragment method viewRepository.

@Override
protected void viewRepository(Repository repository) {
    User owner = repository.owner();
    if (owner != null && org.login().equals(owner.login())) {
        repository = repository.toBuilder().owner(org).build();
    }
    super.viewRepository(repository);
}
Also used : User(com.meisolsson.githubsdk.model.User)

Example 92 with User

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

the class IssuesPagerAdapter method getItem.

@Override
public Fragment getItem(int position) {
    IssueFragment fragment = new IssueFragment();
    Bundle args = new Bundle();
    if (repo != null) {
        args.putString(EXTRA_REPOSITORY_NAME, repo.name());
        User owner = repo.owner();
        args.putString(EXTRA_REPOSITORY_OWNER, owner.login());
        args.putParcelable(EXTRA_USER, owner);
    } else {
        Repository repo = repos.get(position);
        args.putString(EXTRA_REPOSITORY_NAME, repo.name());
        args.putString(EXTRA_REPOSITORY_OWNER, repo.owner().login());
        Issue issue = store.getIssue(repo, issues[position]);
        if (issue != null && issue.user() != null) {
            Repository fullRepo = issue.repository();
            if (fullRepo != null && fullRepo.owner() != null) {
                args.putParcelable(EXTRA_USER, fullRepo.owner());
            }
        }
    }
    args.putInt(EXTRA_ISSUE_NUMBER, issues[position]);
    args.putBoolean(EXTRA_CAN_WRITE_REPO, canWrite);
    fragment.setArguments(args);
    return fragment;
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) User(com.meisolsson.githubsdk.model.User) Issue(com.meisolsson.githubsdk.model.Issue) Bundle(android.os.Bundle)

Example 93 with User

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

the class CreateCommentActivityTest method setUp.

@Before
public void setUp() {
    User user = User.builder().login("owner").build();
    Repository repo = Repository.builder().name("name").owner(user).build();
    activityTestRule.launchActivity(CreateCommentActivity.createIntent(repo, "abcdef"));
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) User(com.meisolsson.githubsdk.model.User) Before(org.junit.Before)

Example 94 with User

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

the class CreateCommentActivityTest method setUp.

@Before
public void setUp() {
    User user = User.builder().login("abc").build();
    Gist gist = Gist.builder().owner(user).id("123").build();
    activityTestRule.launchActivity(CreateCommentActivity.createIntent(gist));
}
Also used : Gist(com.meisolsson.githubsdk.model.Gist) User(com.meisolsson.githubsdk.model.User) Before(org.junit.Before)

Example 95 with User

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

the class RecentRepositoriesTest method testBadInput.

/**
 * Verify bad input
 */
@Test
public void testBadInput() {
    User org = User.builder().id(20L).build();
    RecentRepositories recent = new RecentRepositories(getTargetContext(), org);
    assertFalse(recent.contains(null));
    assertFalse(recent.contains(-1));
}
Also used : User(com.meisolsson.githubsdk.model.User) RecentRepositories(com.github.pockethub.android.ui.repo.RecentRepositories) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

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