use of com.newsrob.DBQuery in project newsrob by marianokamp.
the class DBQueryContentCursorTests method testContentCursorCount.
public void testContentCursorCount() {
DBQuery dbq = new DBQuery(entryManager, null, null);
dbq.setSortOrderAscending(true);
dbq.setShouldHideReadItemsWithoutUpdatingThePreference(false);
assertEquals(5, entryManager.getContentCount(dbq));
}
use of com.newsrob.DBQuery in project newsrob by marianokamp.
the class DBQueryContentCursorTests method testContentCursorOrderAscendingWithLimit.
public void testContentCursorOrderAscendingWithLimit() {
DBQuery dbq = new DBQuery(entryManager, null, null);
dbq.setSortOrderAscending(true);
dbq.setShouldHideReadItemsWithoutUpdatingThePreference(false);
dbq.setLimit(3);
List<String> expectedIds = atomIdsOrderedAscending;
expectedIds = expectedIds.subList(0, 3);
executeAndVerify(dbq, expectedIds);
}
use of com.newsrob.DBQuery 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;
}
use of com.newsrob.DBQuery in project newsrob by marianokamp.
the class AbstractNewsRobListActivity method updateButtons.
protected void updateButtons() {
if (EntryManager.ACTION_BAR_GONE.equals(getEntryManager().getActionBarLocation())) {
ProgressBar progressStatusBar = (ProgressBar) findViewById(R.id.progress_status_bar);
progressStatusBar.setVisibility(entryManager.isModelCurrentlyUpdated() ? View.VISIBLE : View.INVISIBLE);
}
if (shouldActionBarBeHidden())
return;
if (refreshButton == null)
setupButtons();
if (refreshButton == null)
return;
View cancelButton = (View) findViewById(R.id.cancel_sync);
if (cancelButton != null)
cancelButton.setEnabled(entryManager.isModelCurrentlyUpdated() && !entryManager.isCancelRequested());
refreshButton.setTag("Refresh");
refreshButton.setImageResource(R.drawable.gen_toolbar_icon_sync);
refreshButton.setEnabled(shouldRefreshButtonBeEnabled());
refreshButton.setFocusable(refreshButton.isEnabled());
DBQuery dbq = getDbQuery();
boolean shouldHideReadItems = dbq.shouldHideReadItems();
showHideButton.setImageResource(shouldHideReadItems ? R.drawable.gen_toolbar_icon_show : R.drawable.gen_toolbar_icon_hide);
toggleOrderButton.setImageResource(getDbQuery().isSortOrderAscending() ? R.drawable.gen_toolbar_icon_sort_order_ascending : R.drawable.gen_toolbar_icon_sort_order_descending);
markAllReadButton.setEnabled(shouldMarkAllReadButtonBeEnabled());
markAllReadButton.setFocusable(markAllReadButton.isEnabled());
}
use of com.newsrob.DBQuery in project newsrob by marianokamp.
the class ShowArticleActivity method initialize.
private void initialize(Intent i) {
TypedValue tv = new TypedValue();
getTheme().resolveAttribute(R.attr.webViewBackgroundColorLight, tv, true);
backgroundColorLight = Color.parseColor(tv.coerceToString().toString());
backgroundColorDark = Color.argb(255, 11, 11, 11);
int position = i.getExtras().getInt(UIHelper.EXTRA_KEY_POSITION);
if ("com.newsrob.VIEW".equals(i.getAction())) {
contentCursor = getEntryManager().getArticleAsCursor(i.getDataString());
} else if (Intent.ACTION_SEARCH.equals(i.getAction()) && i.hasExtra("atomId")) {
contentCursor = getEntryManager().getArticleAsCursor(i.getExtras().getString("atomId"));
} else {
DBQuery dbQuery = UIHelper.createDBQueryFromIntentExtras(getEntryManager(), i);
dbQuery.setLimit(getEntryManager().getMaxArticlesInArticleList());
contentCursor = getEntryManager().getContentCursor(dbQuery);
}
startManagingCursor(contentCursor);
if (!contentCursor.moveToPosition(position)) {
PL.log("MoveToPosition failed. position=" + position, this);
finish();
return;
}
newPosition();
getEntryManager().updateLastUsed();
currentTheme = getEntryManager().getCurrentThemeResourceId();
}
Aggregations