Search in sources :

Example 1 with WeatherModel

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));
}
Also used : ContentValues(android.content.ContentValues) ArrayList(java.util.ArrayList) CurWeatherModel(tk.woppo.sunday.model.CurWeatherModel) WeatherModel(tk.woppo.sunday.model.WeatherModel)

Example 2 with WeatherModel

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();
}
Also used : WeatherTodayModel(tk.woppo.sunday.model.WeatherTodayModel) SimpleWeatherModel(tk.woppo.sunday.model.SimpleWeatherModel) CurWeatherModel(tk.woppo.sunday.model.CurWeatherModel) WeatherModel(tk.woppo.sunday.model.WeatherModel) AreaModel(tk.woppo.sunday.model.city.AreaModel) Background(org.androidannotations.annotations.Background)

Example 3 with WeatherModel

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;
}
Also used : WeatherModel(tk.woppo.sunday.model.WeatherModel) FutureWeatherItem(tk.woppo.sunday.widget.FutureWeatherItem)

Example 4 with WeatherModel

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;
}
Also used : Cursor(android.database.Cursor) CurWeatherModel(tk.woppo.sunday.model.CurWeatherModel) WeatherModel(tk.woppo.sunday.model.WeatherModel)

Aggregations

WeatherModel (tk.woppo.sunday.model.WeatherModel)4 CurWeatherModel (tk.woppo.sunday.model.CurWeatherModel)3 ContentValues (android.content.ContentValues)1 Cursor (android.database.Cursor)1 ArrayList (java.util.ArrayList)1 Background (org.androidannotations.annotations.Background)1 SimpleWeatherModel (tk.woppo.sunday.model.SimpleWeatherModel)1 WeatherTodayModel (tk.woppo.sunday.model.WeatherTodayModel)1 AreaModel (tk.woppo.sunday.model.city.AreaModel)1 FutureWeatherItem (tk.woppo.sunday.widget.FutureWeatherItem)1