Search in sources :

Example 26 with DBQuery

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

the class DBQueryContentCursorTests method testContentCursorOrderAscending.

public void testContentCursorOrderAscending() {
    DBQuery dbq = new DBQuery(entryManager, null, null);
    dbq.setSortOrderAscending(true);
    dbq.setShouldHideReadItemsWithoutUpdatingThePreference(false);
    List<String> expectedIds = atomIdsOrderedAscending;
    executeAndVerify(dbq, expectedIds);
}
Also used : DBQuery(com.newsrob.DBQuery)

Example 27 with DBQuery

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

the class FeedListActivity method onListItemClick.

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    Cursor c = (Cursor) getListAdapter().getItem(position);
    Long filterFeedId = c.getLong(c.getColumnCount() - 1);
    int frequency = c.getInt(1);
    DBQuery dbq = new DBQuery(getDbQuery());
    dbq.setFilterFeedId(filterFeedId);
    if (frequency == 1) {
        startShowEntryActivityForPosition(0, dbq);
    } else {
        // new File(Environment.getExternalStorageDirectory(),
        // "t").mkdirs();
        // Debug.startMethodTracing("t/launch_al_"
        // + new SimpleDateFormat("yyMMdd-hh:mm:ss").format(new
        // Date()).replace(':', '-'));
        Intent intent = new Intent(this, ArticleListActivity.class);
        UIHelper.addExtrasFromDBQuery(intent, dbq);
        startActivity(intent);
    }
}
Also used : DBQuery(com.newsrob.DBQuery) Intent(android.content.Intent) Cursor(android.database.Cursor)

Example 28 with DBQuery

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

the class FeedListActivity method getToastMessage.

@Override
protected CharSequence getToastMessage() {
    StringBuilder sb = new StringBuilder();
    DBQuery dbq = getDbQuery();
    if (dbq.getFilterLabel() != null && !"all articles".equals(dbq.getFilterLabel()))
        sb.append(dbq.getFilterLabel());
    if (sb.length() == 0)
        sb.append("All Feeds");
    return sb.toString().toLowerCase();
}
Also used : DBQuery(com.newsrob.DBQuery)

Example 29 with DBQuery

use of com.newsrob.DBQuery 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 30 with DBQuery

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

the class AbstractNewsRobListActivity method shouldMarkAllReadButtonBeEnabled.

protected boolean shouldMarkAllReadButtonBeEnabled() {
    DBQuery dbq = new DBQuery(getDbQuery());
    dbq.setShouldHideReadItemsWithoutUpdatingThePreference(true);
    return getEntryManager().isMarkAllReadPossible(dbq);
}
Also used : DBQuery(com.newsrob.DBQuery)

Aggregations

DBQuery (com.newsrob.DBQuery)32 Feed (com.newsrob.Feed)7 Intent (android.content.Intent)3 Entry (com.newsrob.Entry)2 ArrayList (java.util.ArrayList)2 AppWidgetManager (android.appwidget.AppWidgetManager)1 Cursor (android.database.Cursor)1 Bundle (android.os.Bundle)1 TypedValue (android.util.TypedValue)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ProgressBar (android.widget.ProgressBar)1 RemoteViews (android.widget.RemoteViews)1 TextView (android.widget.TextView)1 Date (java.util.Date)1