use of tk.woppo.sunday.model.WeatherModel in project SunDay by iQuick.
the class WeatherDataHelper method bulkInsert.
public void bulkInsert(List<WeatherModel> models) {
ArrayList<ContentValues> contentValueses = new ArrayList<ContentValues>();
for (WeatherModel 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.WeatherModel 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.WeatherModel in project SunDay by iQuick.
the class FutureWeatherAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
WeatherModel model = mList.get(position);
FutureWeatherItem item;
if (convertView == null) {
item = FutureWeatherItem_.build(mContext);
} else {
item = (FutureWeatherItem) convertView;
}
item.bind(model, position);
return item;
}
use of tk.woppo.sunday.model.WeatherModel in project SunDay by iQuick.
the class WeatherDataHelper method query.
public WeatherModel query(String id) {
WeatherModel model = null;
Cursor cursor = query(null, WeatherDBInfo.ID + " = ?", new String[] { id }, null);
if (cursor.moveToFirst()) {
model = WeatherModel.fromCursor(cursor);
}
cursor.close();
return model;
}
Aggregations