use of io.github.izzyleung.zhihudailypurify.bean.DailyNews in project ZhihuDailyPurify by izzyleung.
the class DailyNewsDataSource method newsOfTheDay.
// That reminds you of Queen, huh? ;-)
public List<DailyNews> newsOfTheDay(String date) {
Cursor cursor = database.query(DBHelper.TABLE_NAME, allColumns, DBHelper.COLUMN_DATE + " = " + date, null, null, null, null);
cursor.moveToFirst();
List<DailyNews> newsList = cursorToNewsList(cursor);
cursor.close();
return newsList;
}
use of io.github.izzyleung.zhihudailypurify.bean.DailyNews in project ZhihuDailyPurify by izzyleung.
the class SaveNewsListTask method saveNewsList.
private void saveNewsList(List<DailyNews> newsList) {
DailyNewsDataSource dataSource = ZhihuDailyPurifyApplication.getDataSource();
String date = newsList.get(0).getDate();
List<DailyNews> originalData = dataSource.newsOfTheDay(date);
if (originalData == null || !originalData.equals(newsList)) {
dataSource.insertOrUpdateNewsList(date, new GsonBuilder().create().toJson(newsList));
}
}
Aggregations