Search in sources :

Example 1 with WeatherTodayModel

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();
}
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 2 with WeatherTodayModel

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

Example 3 with WeatherTodayModel

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

Aggregations

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