Search in sources :

Example 1 with Feed

use of com.newsrob.Feed in project newsrob by marianokamp.

the class UnsubscribeFeedTask method onContextItemSelected.

@Override
public boolean onContextItemSelected(final MenuItem item, final int position) {
    Entry entry = findEntryByPosition(position);
    if (entry == null)
        return false;
    if (position > -1 && item.getItemId() == MENU_ITEM_MARK_READ_UNTIL_HERE_ID) {
        DBQuery dbq = new DBQuery(getDbQuery());
        dbq.setDateLimit(entry.getUpdatedInHighResolution());
        instantiateMarkAllReadDialog(dbq);
        return true;
    }
    if (position > -1 && item.getItemId() == MENU_ITEM_UNSUBSCRIBE_FEED_ID) {
        Feed f = getEntryManager().findFeedById(entry.getFeedId());
        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;
    }
    if (ArticleViewHelper.articleActionSelected(this, item, getEntryManager(), entry))
        return true;
    return false;
}
Also used : Entry(com.newsrob.Entry) DBQuery(com.newsrob.DBQuery) Feed(com.newsrob.Feed)

Example 2 with Feed

use of com.newsrob.Feed in project newsrob by marianokamp.

the class UnsubscribeFeedTask method initialize.

private void initialize(Intent i) {
    if (i.hasExtra("FEED_URL")) {
        String feedUrl = i.getStringExtra("FEED_URL");
        long feedId = getEntryManager().findFeedIdByFeedUrl(feedUrl);
        if (feedId == -1) {
            setResult(-1);
            finish();
            return;
        } else
            i.putExtra(UIHelper.EXTRA_KEY_FILTER_FEED, feedId);
    }
    dbQuery = UIHelper.createDBQueryFromIntentExtras(getEntryManager(), i);
    dbQuery.setLimit(250);
    if (dbQuery.getFilterFeedId() != null && dbQuery.getFilterFeedId() > -1l) {
        final Feed f = getEntryManager().findFeedById(dbQuery.getFilterFeedId());
        if (f != null) {
            feedName = f.getTitle();
        } else {
            finish();
            return;
        }
    }
    final Bundle bundle = i.getExtras();
    if (bundle != null && bundle.containsKey(UIHelper.EXTRA_KEY_TITLE))
        title = bundle.getString(UIHelper.EXTRA_KEY_TITLE);
    // ---
    listAdapter = new MyListAdapter();
    setListAdapter(listAdapter);
    updateCursor();
}
Also used : Bundle(android.os.Bundle) Feed(com.newsrob.Feed)

Example 3 with Feed

use of com.newsrob.Feed in project newsrob by marianokamp.

the class FeedListActivity method onCreateContextMenu.

@Override
protected void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo, int selectedPosition) {
    String title = getSelectedTitle(selectedPosition);
    if (title == null)
        return;
    long feedId = getSelectedFeedId(selectedPosition);
    menu.setHeaderTitle(title);
    menu.add(0, MENU_ITEM_MANAGE_FEED_ID, 0, R.string.menu_item_manage_feed);
    menu.add(0, MENU_ITEM_MARK_ALL_READ_ID, 0, R.string.menu_item_mark_all_read);
    DBQuery dbq = new DBQuery(getDbQuery());
    dbq.setFilterFeedId(feedId);
    if (!getEntryManager().isMarkAllReadPossible(dbq))
        menu.getItem(1).setEnabled(false);
    boolean feedCanBeUnsubscribed = false;
    Feed f = getEntryManager().findFeedById(feedId);
    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 : DBQuery(com.newsrob.DBQuery) Feed(com.newsrob.Feed)

Example 4 with Feed

use of com.newsrob.Feed in project newsrob by marianokamp.

the class MarkAllReadDbQueryTests method testIsMarkAllReadPossibleWithLimit.

public void testIsMarkAllReadPossibleWithLimit() {
    Feed f1 = findFeedByArticleAtomId("atomid1");
    DBQuery dbq = new DBQuery(entryManager, null, f1.getId());
    dbq.setLimit(4);
    assertTrue(entryManager.isMarkAllReadPossible(dbq));
}
Also used : DBQuery(com.newsrob.DBQuery) Feed(com.newsrob.Feed)

Example 5 with Feed

use of com.newsrob.Feed in project newsrob by marianokamp.

the class MarkAllReadDbQueryTests method testIsMarkAllReadPossible.

public void testIsMarkAllReadPossible() {
    Feed f1 = findFeedByArticleAtomId("atomid1");
    DBQuery dbq = new DBQuery(entryManager, null, f1.getId());
    assertTrue(entryManager.isMarkAllReadPossible(dbq));
}
Also used : DBQuery(com.newsrob.DBQuery) 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