use of android.support.annotation.WorkerThread in project Lightning-Browser by anthonycr.
the class HistoryDatabase method addHistoryItem.
@WorkerThread
private synchronized void addHistoryItem(@NonNull HistoryItem item) {
ContentValues values = new ContentValues();
values.put(KEY_URL, item.getUrl());
values.put(KEY_TITLE, item.getTitle());
values.put(KEY_TIME_VISITED, System.currentTimeMillis());
lazyDatabase().insert(TABLE_HISTORY, null, values);
}
use of android.support.annotation.WorkerThread in project Lightning-Browser by anthonycr.
the class HistoryDatabase method getAllHistoryItems.
@WorkerThread
@NonNull
synchronized List<HistoryItem> getAllHistoryItems() {
List<HistoryItem> itemList = new ArrayList<>();
Cursor cursor = lazyDatabase().query(TABLE_HISTORY, null, null, null, null, null, KEY_TIME_VISITED + " DESC");
while (cursor.moveToNext()) {
itemList.add(fromCursor(cursor));
}
cursor.close();
return itemList;
}
Aggregations