Search in sources :

Example 6 with Feed

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));
}
Also used : DBQuery(com.newsrob.DBQuery) Feed(com.newsrob.Feed)

Example 7 with Feed

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));
}
Also used : DBQuery(com.newsrob.DBQuery) Feed(com.newsrob.Feed)

Example 8 with Feed

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;
}
Also used : DBQuery(com.newsrob.DBQuery) Intent(android.content.Intent) Feed(com.newsrob.Feed)

Example 9 with Feed

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));
    }
}
Also used : Feed(com.newsrob.Feed)

Example 10 with Feed

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);
    }
}
Also used : Entry(com.newsrob.Entry) Feed(com.newsrob.Feed)

Aggregations

Feed (com.newsrob.Feed)10 DBQuery (com.newsrob.DBQuery)7 Entry (com.newsrob.Entry)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1