use of io.github.izzyleung.zhihudailypurify.db.DailyNewsDataSource in project ZhihuDailyPurify by izzyleung.
the class ZhihuDailyPurifyApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
applicationContext = this;
initImageLoader(getApplicationContext());
dataSource = new DailyNewsDataSource(getApplicationContext());
dataSource.open();
}
use of io.github.izzyleung.zhihudailypurify.db.DailyNewsDataSource 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