mRuntime.getContextProxy().getResolver().insert(
Uri.parse(ICGlobalSettingsProvider.SETTINGS),
wtCodeValues);
+ ContentValues wtLocationValues = new ContentValues();
+ wtLocationValues.put(ICDatabaseHelper.sKey, "weather_location");
+ wtLocationValues.put(ICDatabaseHelper.sValue, genericWeatherInfo.getCityName());
+ mRuntime.getContextProxy().getResolver().insert(
+ Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+ wtLocationValues);
+ ContentValues wtDescValues = new ContentValues();
+ wtDescValues.put(ICDatabaseHelper.sKey, "weather_desc");
+ wtDescValues.put(ICDatabaseHelper.sValue, genericWeatherInfo.getDescription());
+ mRuntime.getContextProxy().getResolver().insert(
+ Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+ wtDescValues);
} else {
ICLogger.i(" BPTQ Format error!");
}
Uri.parse(ICGlobalSettingsProvider.SETTINGS),
tempValues
);
+ //城市
+ ContentValues locationValues = new ContentValues();
+ locationValues.put(ICDatabaseHelper.sKey, "weather_location");
+ locationValues.put(ICDatabaseHelper.sValue, cityName);
+ mRuntime.getContextProxy().getResolver().insert(
+ Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+ locationValues
+ );
+ //天气描述
+ ContentValues descriptionValues = new ContentValues();
+ descriptionValues.put(ICDatabaseHelper.sKey, "weather_desc");
+ descriptionValues.put(ICDatabaseHelper.sValue, wtDesc);
+ mRuntime.getContextProxy().getResolver().insert(
+ Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+ descriptionValues
+ );
if (mRuntime.mFZDWeatherCallback != null) {
mRuntime.mFZDWeatherCallback.onWeatherInfoLoaded(fzdWeatherInfo);
}
StringBuilder sb = new StringBuilder();
StringBuilder msg = new StringBuilder();
- String City = Util.decodeUnicode2Utf8(cmdlist[22]);
+ String cityName = Util.decodeUnicode2Utf8(cmdlist[22]);
List<GenericWeatherInfo> weatherInfo = new ArrayList<>();
for (int i = 0; i < 3; i++) {
String DayTime = cmdlist[1 + i * 7] + " " + cmdlist[2 + i * 7];
//返回数据给UI
GenericWeatherInfo itemFirst = new GenericWeatherInfo(DayTime,
- weather_name, weather_id, temp_current, temp_low, temp_high, City);
+ weather_name, weather_id, temp_current, temp_low, temp_high, cityName);
//封装数据
weatherInfo.add(itemFirst);
+ if (i == 0) {
+
+ //插入天气类型
+ ContentValues wtCodeValues = new ContentValues();
+ wtCodeValues.put(ICDatabaseHelper.sKey, "weather_type");
+ wtCodeValues.put(ICDatabaseHelper.sValue, weather_id);
+ mRuntime.getContextProxy().getResolver().insert(
+ Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+ wtCodeValues
+ );
+ //插入天气当前温度
+ ContentValues tempValues = new ContentValues();
+ tempValues.put(ICDatabaseHelper.sKey, "weather_temp");
+ tempValues.put(ICDatabaseHelper.sValue, temp_current);
+ mRuntime.getContextProxy().getResolver().insert(
+ Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+ tempValues
+ );
+ //城市
+ ContentValues locationValues = new ContentValues();
+ locationValues.put(ICDatabaseHelper.sKey, "weather_location");
+ locationValues.put(ICDatabaseHelper.sValue, cityName);
+ mRuntime.getContextProxy().getResolver().insert(
+ Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+ locationValues
+ );
+ //天气描述
+ ContentValues descriptionValues = new ContentValues();
+ descriptionValues.put(ICDatabaseHelper.sKey, "weather_desc");
+ descriptionValues.put(ICDatabaseHelper.sValue, weather_name);
+ mRuntime.getContextProxy().getResolver().insert(
+ Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+ descriptionValues
+ );
+ }
}
- ICLogger.i(City + " \n" + sb.toString());
+ ICLogger.i(cityName + " \n" + sb.toString());
- msg.insert(0, City + ";");
+ msg.insert(0, cityName + ";");
String weatherstr = msg.toString();
if (weatherstr.endsWith(";")) {
weatherstr = weatherstr.substring(0, weatherstr.lastIndexOf(";"));