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));
}
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());
}
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);
}
}
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);
}
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;
}
Aggregations