use of tk.woppo.sunday.model.WeatherTodayModel in project SunDay by iQuick.
the class HomeFragment method getDataFromDB.
/**
* 从数据库中获取数据
*/
@Background
void getDataFromDB() {
for (AreaModel model : App.getMyArea()) {
WeatherModel weatherModel = mWeatherDB.query(model.getWeatherCode());
WeatherTodayModel weatherTodayModel = mTodayDB.query(model.getWeatherCode());
if (weatherModel != null) {
mWeatherModels.add(weatherModel);
mSimpleWeatherModels.add(weatherModel.toSimpleWeatherList());
}
if (weatherTodayModel != null)
mWeatherTodayModels.add(weatherTodayModel);
}
// 更新列表
updateWeatherList();
}
use of tk.woppo.sunday.model.WeatherTodayModel in project SunDay by iQuick.
the class WeatherTodayDataHelper method bulkInsert.
public void bulkInsert(List<WeatherTodayModel> models) {
ArrayList<ContentValues> contentValueses = new ArrayList<ContentValues>();
for (WeatherTodayModel model : models) {
ContentValues values = getContentValues(model);
contentValueses.add(values);
}
ContentValues[] valueArray = new ContentValues[contentValueses.size()];
bulkInsert(contentValueses.toArray(valueArray));
}
use of tk.woppo.sunday.model.WeatherTodayModel in project SunDay by iQuick.
the class WeatherTodayDataHelper method query.
public WeatherTodayModel query(String id) {
WeatherTodayModel model = null;
Cursor cursor = query(null, WeatherTodayDBInfo.ID + " = ?", new String[] { id }, null);
if (cursor.moveToFirst()) {
model = WeatherTodayModel.fromCursor(cursor);
}
cursor.close();
return model;
}
Aggregations