Search in sources :

Example 6 with IssueFilter

use of com.github.pockethub.android.core.issue.IssueFilter in project PocketHub by pockethub.

the class EditIssuesFilterActivityTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    Repository repo = InfoUtils.createRepoFromData("owner", "name");
    IssueFilter filter = new IssueFilter(repo);
    setActivityIntent(EditIssuesFilterActivity.createIntent(filter));
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) IssueFilter(com.github.pockethub.android.core.issue.IssueFilter)

Example 7 with IssueFilter

use of com.github.pockethub.android.core.issue.IssueFilter in project PocketHub by pockethub.

the class IssueFilterTest method testEqualFilter.

/**
     * Verify {@link IssueFilter#equals(Object)}
     */
public void testEqualFilter() {
    Repository repo = Repository.builder().id(1L).build();
    IssueFilter filter1 = new IssueFilter(repo);
    assertFalse(filter1.equals(null));
    assertFalse(filter1.equals(""));
    assertTrue(filter1.equals(filter1));
    IssueFilter filter2 = new IssueFilter(repo);
    assertEquals(filter1, filter2);
    assertEquals(filter1.hashCode(), filter2.hashCode());
    User user = User.builder().id(2).build();
    filter1.setAssignee(user);
    assertFalse(filter1.equals(filter2));
    filter2.setAssignee(user);
    assertEquals(filter1, filter2);
    assertEquals(filter1.hashCode(), filter2.hashCode());
    filter1.setOpen(false);
    assertFalse(filter1.equals(filter2));
    filter2.setOpen(false);
    assertEquals(filter1, filter2);
    assertEquals(filter1.hashCode(), filter2.hashCode());
    Milestone milestone = Milestone.builder().number(3).build();
    filter1.setMilestone(milestone);
    assertFalse(filter1.equals(filter2));
    filter2.setMilestone(milestone);
    assertEquals(filter1, filter2);
    assertEquals(filter1.hashCode(), filter2.hashCode());
}
Also used : Repository(com.meisolsson.githubsdk.model.Repository) User(com.meisolsson.githubsdk.model.User) Milestone(com.meisolsson.githubsdk.model.Milestone) IssueFilter(com.github.pockethub.android.core.issue.IssueFilter)

Example 8 with IssueFilter

use of com.github.pockethub.android.core.issue.IssueFilter in project PocketHub by pockethub.

the class AccountDataManager method removeIssueFilter.

/**
     * Add issue filter from store
     * <p/>
     * This method may perform file I/O and should never be called on the
     * UI-thread
     *
     * @param filter
     */
public void removeIssueFilter(IssueFilter filter) {
    final File cache = new File(root, "issue_filters.ser");
    Collection<IssueFilter> filters = read(cache);
    if (filters != null && filters.remove(filter)) {
        write(cache, filters);
    }
}
Also used : File(java.io.File) IssueFilter(com.github.pockethub.android.core.issue.IssueFilter)

Example 9 with IssueFilter

use of com.github.pockethub.android.core.issue.IssueFilter in project PocketHub by pockethub.

the class IssuesFragment method onActivityResult.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK && requestCode == ISSUE_FILTER_EDIT && data != null) {
        IssueFilter newFilter = data.getParcelableExtra(EXTRA_ISSUE_FILTER);
        if (!filter.equals(newFilter)) {
            filter = newFilter;
            updateFilterSummary();
            pager.reset();
            refreshWithProgress();
            return;
        }
    }
    if (requestCode == ISSUE_VIEW) {
        notifyDataSetChanged();
        forceRefresh();
        return;
    }
    if (requestCode == ISSUE_CREATE && resultCode == RESULT_OK) {
        Issue created = data.getParcelableExtra(EXTRA_ISSUE);
        forceRefresh();
        startActivityForResult(IssuesViewActivity.createIntent(created, repository), ISSUE_VIEW);
        return;
    }
    super.onActivityResult(requestCode, resultCode, data);
}
Also used : Issue(com.meisolsson.githubsdk.model.Issue) IssueFilter(com.github.pockethub.android.core.issue.IssueFilter)

Example 10 with IssueFilter

use of com.github.pockethub.android.core.issue.IssueFilter in project PocketHub by pockethub.

the class FiltersViewActivity method onItemLongClick.

@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    IssueFilter filter = (IssueFilter) parent.getItemAtPosition(position);
    Bundle args = new Bundle();
    args.putParcelable(ARG_FILTER, filter);
    ConfirmDialogFragment.show(this, REQUEST_DELETE, getString(R.string.confirm_bookmark_delete_title), getString(R.string.confirm_bookmark_delete_message), args);
    return true;
}
Also used : Bundle(android.os.Bundle) IssueFilter(com.github.pockethub.android.core.issue.IssueFilter)

Aggregations

IssueFilter (com.github.pockethub.android.core.issue.IssueFilter)11 File (java.io.File)3 Bundle (android.os.Bundle)2 Repository (com.meisolsson.githubsdk.model.Repository)2 Issue (com.meisolsson.githubsdk.model.Issue)1 Milestone (com.meisolsson.githubsdk.model.Milestone)1 User (com.meisolsson.githubsdk.model.User)1