Use temperature unit from CMSettings on weather update requests

Make sure the the weather update requests are using the temperature
unit set by the user in the weather settings

Change-Id: Iac3a891b5afbcf36a87386f828b40bcbd0e1de02
TICKET: CYNGNOS-2429
This commit is contained in:
Luis Vidal 2016-04-12 23:59:32 -07:00
parent ed4d063611
commit 377fffca69
1 changed files with 12 additions and 0 deletions

View File

@ -26,6 +26,8 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.ArraySet;
import cyanogenmod.app.CMContextConstants;
import cyanogenmod.providers.CMSettings;
import cyanogenmod.providers.WeatherContract;
import java.util.ArrayList;
import java.util.Collections;
@ -142,9 +144,14 @@ public class CMWeatherManager {
}
try {
int tempUnit = CMSettings.Global.getInt(mContext.getContentResolver(),
CMSettings.Global.WEATHER_TEMPERATURE_UNIT,
WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT);
RequestInfo info = new RequestInfo
.Builder(mRequestInfoListener)
.setLocation(location)
.setTemperatureUnit(tempUnit)
.build();
if (listener != null) mWeatherUpdateRequestListeners.put(info, listener);
sWeatherManagerService.updateWeather(info);
@ -175,9 +182,14 @@ public class CMWeatherManager {
}
try {
int tempUnit = CMSettings.Global.getInt(mContext.getContentResolver(),
CMSettings.Global.WEATHER_TEMPERATURE_UNIT,
WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT);
RequestInfo info = new RequestInfo
.Builder(mRequestInfoListener)
.setWeatherLocation(weatherLocation)
.setTemperatureUnit(tempUnit)
.build();
if (listener != null) mWeatherUpdateRequestListeners.put(info, listener);
sWeatherManagerService.updateWeather(info);