diff options
author | Danesh M <daneshm90@gmail.com> | 2014-09-04 10:00:12 -0700 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2014-09-04 10:00:50 -0700 |
commit | fdb3640e249c25155f2f1f52a85be43377a8b7a3 (patch) | |
tree | 7f9cd5bee7298cfde9e5d3c19488274240a99eac | |
parent | 8239598887291668d280975894ff623fc0191b5e (diff) | |
download | android_packages_apps_LockClock-fdb3640e249c25155f2f1f52a85be43377a8b7a3.tar.gz android_packages_apps_LockClock-fdb3640e249c25155f2f1f52a85be43377a8b7a3.tar.bz2 android_packages_apps_LockClock-fdb3640e249c25155f2f1f52a85be43377a8b7a3.zip |
LockClock : Return condition code as part of query
Change-Id: Ide9be5cd181576e2f61927c5027cfa4724300b90
-rw-r--r-- | src/com/cyanogenmod/lockclock/weather/WeatherContentProvider.java | 14 | ||||
-rwxr-xr-x | src/com/cyanogenmod/lockclock/weather/WeatherInfo.java | 8 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/com/cyanogenmod/lockclock/weather/WeatherContentProvider.java b/src/com/cyanogenmod/lockclock/weather/WeatherContentProvider.java index 25c2edf..a2ab385 100644 --- a/src/com/cyanogenmod/lockclock/weather/WeatherContentProvider.java +++ b/src/com/cyanogenmod/lockclock/weather/WeatherContentProvider.java @@ -32,10 +32,12 @@ public class WeatherContentProvider extends ContentProvider { private static final String COLUMN_CURRENT_HUMIDITY = "humidity"; private static final String COLUMN_CURRENT_WIND = "wind"; private static final String COLUMN_CURRENT_TIME_STAMP = "time_stamp"; + private static final String COLUMN_CURRENT_CONDITION_CODE = "condition_code"; private static final String COLUMN_FORECAST_LOW = "forecast_low"; private static final String COLUMN_FORECAST_HIGH = "forecast_high"; private static final String COLUMN_FORECAST_CONDITION = "forecast_condition"; + private static final String COLUMN_FORECAST_CONDITION_CODE = "forecast_condition_code"; private static final String[] PROJECTION_DEFAULT_CURRENT = new String[] { COLUMN_CURRENT_CITY_ID, @@ -44,13 +46,15 @@ public class WeatherContentProvider extends ContentProvider { COLUMN_CURRENT_TEMPERATURE, COLUMN_CURRENT_HUMIDITY, COLUMN_CURRENT_WIND, - COLUMN_CURRENT_TIME_STAMP + COLUMN_CURRENT_TIME_STAMP, + COLUMN_CURRENT_CONDITION_CODE }; private static final String[] PROJECTION_DEFAULT_FORECAST = new String[] { COLUMN_FORECAST_LOW, COLUMN_FORECAST_HIGH, COLUMN_FORECAST_CONDITION, + COLUMN_FORECAST_CONDITION_CODE }; private static final String[] PROJECTION_DEFAULT_EVERYTHING = new String[] { @@ -61,10 +65,12 @@ public class WeatherContentProvider extends ContentProvider { COLUMN_CURRENT_HUMIDITY, COLUMN_CURRENT_WIND, COLUMN_CURRENT_TIME_STAMP, + COLUMN_CURRENT_CONDITION_CODE, COLUMN_FORECAST_LOW, COLUMN_FORECAST_HIGH, COLUMN_FORECAST_CONDITION, + COLUMN_FORECAST_CONDITION_CODE }; public static final String AUTHORITY = "com.cyanogenmod.lockclock.weather.provider"; @@ -108,14 +114,16 @@ public class WeatherContentProvider extends ContentProvider { .add(COLUMN_CURRENT_WIND, weather.getFormattedWindSpeed() + " " + weather.getWindDirection()) .add(COLUMN_CURRENT_TEMPERATURE, weather.getFormattedTemperature()) - .add(COLUMN_CURRENT_TIME_STAMP, weather.getTimestamp().toString()); + .add(COLUMN_CURRENT_TIME_STAMP, weather.getTimestamp().toString()) + .add(COLUMN_CURRENT_CONDITION_CODE, weather.getConditionCode()); // forecast for (DayForecast day : weather.getForecasts()) { result.newRow() .add(COLUMN_FORECAST_CONDITION, day.getCondition(mContext)) .add(COLUMN_FORECAST_LOW, day.getFormattedLow()) - .add(COLUMN_FORECAST_HIGH, day.getFormattedHigh()); + .add(COLUMN_FORECAST_HIGH, day.getFormattedHigh()) + .add(COLUMN_FORECAST_CONDITION_CODE, day.getConditionCode()); } return result; } else { diff --git a/src/com/cyanogenmod/lockclock/weather/WeatherInfo.java b/src/com/cyanogenmod/lockclock/weather/WeatherInfo.java index b7c09d5..7ad4339 100755 --- a/src/com/cyanogenmod/lockclock/weather/WeatherInfo.java +++ b/src/com/cyanogenmod/lockclock/weather/WeatherInfo.java @@ -99,6 +99,10 @@ public class WeatherInfo { public String getCondition(Context context) { return WeatherInfo.getCondition(context, conditionCode, condition); } + + public int getConditionCode() { + return conditionCode; + } } public int getConditionResource(String set) { @@ -125,6 +129,10 @@ public class WeatherInfo { return getCondition(mContext, conditionCode, condition); } + public int getConditionCode() { + return conditionCode; + } + private static String getCondition(Context context, int conditionCode, String condition) { final Resources res = context.getResources(); final int resId = res.getIdentifier("weather_" + conditionCode, "string", context.getPackageName()); |