From: TrillGates Date: Fri, 23 Jul 2021 03:42:24 +0000 (+0800) Subject: add weather location and description into settings. X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=12611a16c3bb881eb8303f21da6395923eb86382;p=protocol_srv.git add weather location and description into settings. --- diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index ced329ee..ca049965 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -465,8 +465,6 @@ public class CoreService extends Service { AbstractInvokeHandlerService invokeHandlerServiceChain; - private boolean isBinded = false; - private AntiMonitorService antiservice; LocationClient locationClient; diff --git a/app/src/main/java/com/ic/protocols/protocol_anan.java b/app/src/main/java/com/ic/protocols/protocol_anan.java index 36c96207..db0fbe5f 100644 --- a/app/src/main/java/com/ic/protocols/protocol_anan.java +++ b/app/src/main/java/com/ic/protocols/protocol_anan.java @@ -977,6 +977,18 @@ public class protocol_anan { 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!"); } diff --git a/app/src/main/java/com/ic/protocols/protocol_fzd.java b/app/src/main/java/com/ic/protocols/protocol_fzd.java index 3c9cfcfd..c582e660 100644 --- a/app/src/main/java/com/ic/protocols/protocol_fzd.java +++ b/app/src/main/java/com/ic/protocols/protocol_fzd.java @@ -2482,6 +2482,22 @@ public class protocol_fzd { 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); } diff --git a/app/src/main/java/com/ic/protocols/protocol_s123.java b/app/src/main/java/com/ic/protocols/protocol_s123.java index d9abdee0..841ee1ba 100644 --- a/app/src/main/java/com/ic/protocols/protocol_s123.java +++ b/app/src/main/java/com/ic/protocols/protocol_s123.java @@ -2610,7 +2610,7 @@ public class protocol_s123 { StringBuilder sb = new StringBuilder(); StringBuilder msg = new StringBuilder(); - String City = Util.decodeUnicode2Utf8(cmdlist[22]); + String cityName = Util.decodeUnicode2Utf8(cmdlist[22]); List weatherInfo = new ArrayList<>(); for (int i = 0; i < 3; i++) { String DayTime = cmdlist[1 + i * 7] + " " + cmdlist[2 + i * 7]; @@ -2639,13 +2639,48 @@ public class protocol_s123 { //返回数据给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(";"));