Search in sources :

Example 1 with AgendaCursor

use of com.orgzly.android.provider.AgendaCursor in project orgzly-android by orgzly.

the class ListWidgetViewsFactory method onDataSetChanged.

@Override
public void onDataSetChanged() {
    if (mCursor != null) {
        mCursor.close();
    }
    // Parse query
    QueryParser queryParser = new InternalQueryParser();
    Query query = queryParser.parse(queryString);
    isPartitioned = query.getOptions().getAgendaDays() > 0;
    // from http://stackoverflow.com/a/20645908
    final long token = Binder.clearCallingIdentity();
    try {
        if (isPartitioned) {
            Cursor cursor = NotesClient.getCursorForQuery(mContext, queryString);
            AgendaCursor.AgendaMergedCursor agendaCursor = AgendaCursor.INSTANCE.create(mContext, cursor, queryString);
            mCursor = agendaCursor.getCursor();
            originalNoteIDs = agendaCursor.getOriginalNoteIDs();
        } else {
            mCursor = NotesClient.getCursorForQuery(mContext, queryString);
        }
    } finally {
        Binder.restoreCallingIdentity(token);
    }
}
Also used : InternalQueryParser(com.orgzly.android.query.user.InternalQueryParser) QueryParser(com.orgzly.android.query.QueryParser) InternalQueryParser(com.orgzly.android.query.user.InternalQueryParser) Query(com.orgzly.android.query.Query) AgendaCursor(com.orgzly.android.provider.AgendaCursor) Cursor(android.database.Cursor) AgendaCursor(com.orgzly.android.provider.AgendaCursor)

Aggregations

Cursor (android.database.Cursor)1 AgendaCursor (com.orgzly.android.provider.AgendaCursor)1 Query (com.orgzly.android.query.Query)1 QueryParser (com.orgzly.android.query.QueryParser)1 InternalQueryParser (com.orgzly.android.query.user.InternalQueryParser)1