use of com.newsrob.Feed in project newsrob by marianokamp.
the class MarkAllReadDbQueryTests method testMarkAllReadWithFeed.
public void testMarkAllReadWithFeed() {
Feed f1 = findFeedByArticleAtomId("atomid1");
Feed f2 = findFeedByArticleAtomId("atomid2");
DBQuery dbq = new DBQuery(entryManager, null, null);
dbq.setFilterFeedId(f1.getId());
assertEquals(4, entryManager.getMarkAllReadCount(dbq));
// one read and two unread articles in this feed
dbq.setFilterFeedId(f2.getId());
assertEquals(0, entryManager.getMarkAllReadCount(dbq));
// non-existent feed
dbq.setFilterFeedId(999l);
assertEquals(0, entryManager.getMarkAllReadCount(dbq));
}
use of com.newsrob.Feed in project newsrob by marianokamp.
the class MarkAllReadDbQueryTests method testIsMarkAllReadPossibleNegative.
public void testIsMarkAllReadPossibleNegative() {
Feed f2 = findFeedByArticleAtomId("atomid2");
DBQuery dbq = new DBQuery(entryManager, null, f2.getId());
assertFalse(entryManager.isMarkAllReadPossible(dbq));
}
use of com.newsrob.Feed in project newsrob by marianokamp.
the class FeedListActivity method onContextItemSelected.
@Override
protected boolean onContextItemSelected(MenuItem item, int selectedPosition) {
Long feedId = getSelectedFeedId(selectedPosition);
if (feedId == null || feedId == -1l)
return false;
if (item.getItemId() == MENU_ITEM_MANAGE_FEED_ID) {
startActivity(new Intent(this, ManageFeedActivity.class).putExtra(ManageFeedActivity.EXTRA_FEED_ID, feedId));
} else if (item.getItemId() == MENU_ITEM_MARK_ALL_READ_ID) {
DBQuery dbq = getDbQuery();
instantiateMarkAllReadDialog(dbq.getFilterLabel(), feedId, dbq.getStartDate(), dbq.getDateLimit(), dbq.isSortOrderAscending(), dbq.getLimit());
}
if (item.getItemId() == MENU_ITEM_UNSUBSCRIBE_FEED_ID) {
Feed f = getEntryManager().findFeedById(feedId);
if (f == null)
return true;
final String feedAtomId = f.getAtomId();
Runnable r = new Runnable() {
@Override
public void run() {
new UnsubscribeFeedTask(getEntryManager()).execute(feedAtomId);
}
};
showConfirmationDialog("Unsubscribe from \'" + f.getTitle() + "\' during the next sync and mark all remaining articles read?", r);
return true;
}
return true;
}
use of com.newsrob.Feed in project newsrob by marianokamp.
the class ShowArticleActivity method adjustScale.
private void adjustScale(Entry selectedEntry) {
if (selectedEntry == null)
return;
Feed f = getEntryManager().findFeedById(selectedEntry.getFeedId());
if (f != null) {
float targetScale = (viewMode == VIEW_MODE_ALTERNATE ? f.getWebScale() : f.getFeedScale());
// not set yet? LATER move it to Feed?
if (Math.abs(targetScale + 1.0f) < 0.02f)
targetScale = defaultScale;
currentScale = targetScale;
webView.setInitialScale((int) (100 * targetScale));
}
}
use of com.newsrob.Feed in project newsrob by marianokamp.
the class UnsubscribeFeedTask method onCreateContextMenu.
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo, final int position) {
final Entry entry = findEntryByPosition(position);
if (entry != null) {
ArticleViewHelper.createArticleMenu(menu, this, entry);
if (getEntryManager().isProVersion())
menu.add(0, MENU_ITEM_MARK_READ_UNTIL_HERE_ID, 3, "Mark Read Until Here");
else {
menu.add(0, MENU_ITEM_MARK_READ_UNTIL_HERE_ID, 99, "Mark Read Until Here").setEnabled(false);
}
boolean feedCanBeUnsubscribed = false;
Feed f = getEntryManager().findFeedById(entry.getFeedId());
if (f != null)
feedCanBeUnsubscribed = !getEntryManager().isModelCurrentlyUpdated() && getEntryManager().canFeedBeUnsubscribed(f.getAtomId());
menu.add(0, MENU_ITEM_UNSUBSCRIBE_FEED_ID, 10, "Unsubscribe Feed").setEnabled(feedCanBeUnsubscribed);
}
}