WeatherInformation: new preferences wind and kelvin
authorgu.martinm@gmail.com <gu.martinm@gmail.com>
Tue, 7 Oct 2014 19:51:40 +0000 (21:51 +0200)
committergu.martinm@gmail.com <gu.martinm@gmail.com>
Tue, 7 Oct 2014 19:51:40 +0000 (21:51 +0200)
res/layout/weather_current_fragment.xml
res/layout/weather_specific_fragment.xml
res/values/arrays.xml
res/values/strings.xml
res/xml/weather_preferences.xml
src/de/example/exampletdd/fragment/current/CurrentFragment.java
src/de/example/exampletdd/fragment/overview/OverviewFragment.java
src/de/example/exampletdd/fragment/preferences/WeatherInformationPreferencesFragment.java
src/de/example/exampletdd/fragment/specific/SpecificFragment.java

index 3533424..74a56ec 100644 (file)
                                android:layout_gravity="start"
                                android:layout_margin="5dp"
                                android:gravity="start"
-                               android:text="FEELS LIKE"
+                               android:text="@string/text_field_feels_like"
                                android:textAlignment="textStart"
                                android:textAppearance="?android:attr/textAppearanceMedium"
                                android:textColor="@color/weather_time_of_day_color_title"
                                android:id="@+id/weather_current_snow"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                                       android:text="SNOW"
+                                       android:text="@string/text_field_snow"
                                        android:gravity="end"
                                android:layout_gravity="end"
                                android:textAlignment="textEnd"
                                android:layout_gravity="start"
                                android:layout_margin="5dp"
                                android:gravity="start"
-                               android:text="HUMIDITY"
+                               android:text="@string/text_field_humidity"
                                android:textAlignment="textStart"
                                android:textAppearance="?android:attr/textAppearanceMedium"
                                android:textColor="@color/weather_time_of_day_color_title"
                                android:id="@+id/weather_current_rain"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                                       android:text="RAIN"
+                                       android:text="@string/text_field_rain"
                                android:layout_gravity="end"
                                android:gravity="end"
                                android:textAlignment="textEnd"
                                android:id="@+id/weather_current_wind"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                               android:text="WIND"
+                               android:text="@string/text_field_wind"
                                android:layout_gravity="start"
                                android:gravity="start"
                                android:textAlignment="textStart"
                                android:id="@+id/weather_current_clouds"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                               android:text="CLOUDS"
+                               android:text="@string/text_field_clouds"
                                android:layout_gravity="end"
                                android:gravity="end"
                                android:textAlignment="textEnd"
                        android:id="@+id/weather_current_pressure"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android:text="PRESSURE"
+                       android:text="@string/text_field_pressure"
                        android:layout_gravity="center"
                        android:gravity="center"
                        android:textAlignment="center"
                        android:id="@+id/weather_current_sunrise"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android:text="SUN RISE"
+                       android:text="@string/text_field_sun_rise"
                        android:layout_gravity="center"
                        android:gravity="center"
                        android:textAlignment="center"
                        android:id="@+id/weather_current_sunset"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android:text="SUN SET"
+                       android:text="@string/text_field_sun_set"
                        android:layout_gravity="center"
                        android:gravity="center"
                        android:textAlignment="center"
index 71f22d8..fd80c01 100644 (file)
                        android:layout_gravity="start"
                        android:layout_margin="5dp"
                        android:gravity="start"
-                       android:text="HUMIDITY"
+                       android:text="@string/text_field_humidity"
                        android:textAlignment="textStart"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textColor="@color/weather_time_of_day_color_title"
                        android:id="@+id/weather_specific_rain"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                               android:text="RAIN"
+                               android:text="@string/text_field_rain"
                        android:layout_gravity="end"
                        android:gravity="end"
                        android:textAlignment="textEnd"
                        android:id="@+id/weather_specific_wind"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android:text="WIND"
+                       android:text="@string/text_field_wind"
                        android:layout_gravity="start"
                        android:gravity="start"
                        android:textAlignment="textStart"
                        android:id="@+id/weather_specific_clouds"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android:text="CLOUDS"
+                       android:text="@string/text_field_clouds"
                        android:layout_gravity="end"
                        android:gravity="end"
                        android:textAlignment="textEnd"
                        android:id="@+id/weather_specific_pressure"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android:text="PRESSURE"
+                       android:text="@string/text_field_pressure"
                        android:layout_gravity="center"
                        android:gravity="center"
                        android:textAlignment="center"
index ef2b6d3..0404af5 100644 (file)
@@ -1,12 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <string-array name="weather_preferences_units_value">
-        <item>Celsius</item>
-        <item>Fahrenheit</item>
+        <item>ºC</item>
+        <item>ºF</item>
+        <item>K</item>
     </string-array>
     <string-array name="weather_preferences_units_human_value">
         <item>Celsius</item>
         <item>Fahrenheit</item>
+        <item>Kelvin</item>
     </string-array>
     <string-array name="weather_preferences_language_value">
         <item>ar</item>
@@ -82,7 +84,7 @@
         <item>half day</item>
         <item>one day</item>     
     </string-array>
-        <string-array name="weather_preferences_refresh_interval">
+    <string-array name="weather_preferences_refresh_interval">
         <item>300000</item>
         <item>900000</item>
         <item>1800000</item>
         <item>half day</item>
         <item>one day</item>
     </string-array>
+    <string-array name="weather_preferences_wind">
+        <item>m/s</item>
+        <item>mph</item>
+    </string-array>
+    <string-array name="weather_preferences_wind_human_value">
+        <item>meter per second</item>
+        <item>miles per hour</item>
+    </string-array>
 </resources>
index e4153b8..3150a22 100644 (file)
@@ -21,7 +21,6 @@
     <string name="weather_preferences_actionbar_title">Settings</string>
     <string name="weather_preferences_units">Units</string>
     <string name="weather_preferences_units_key">weather_preferences_units</string>
-    <string name="weather_preferences_units_fahrenheit">Fahrenheit</string>
     <string name="weather_preferences_units_celsius">Celsius</string>
     <string name="weather_preferences_temperature_units">Temperature</string>
     <string name="weather_preferences_notifications">Notifications</string>
@@ -36,6 +35,9 @@
     <string name="weather_preferences_day_forecast">Forecast days number</string>
     <string name="weather_preferences_refresh_interval_key">weather_preferences_refresh_interval</string>
     <string name="weather_preferences_refresh_interval">Refresh interval</string>
+    <string name="weather_preferences_wind_key">weather_preferences_wind</string>
+    <string name="weather_preferences_wind">Wind</string>
+    <string name="weather_preferences_wind_summary">Wind</string>
     <string name="city_not_found">city not found</string>
     <string name="country_not_found">country not found</string>
     <string name="progress_dialog_generic_message">Please wait&#8230;</string>
@@ -46,8 +48,6 @@
        <string name="weather_map_button_getlocation">Get Location</string>
        <string name="text_units_mm3h">mm 3h</string>
        <string name="text_units_percent">%</string>
-       <string name="text_units_centigrade">ºC</string>
-       <string name="text_units_ms">m/s</string>
        <string name="text_units_hpa">hpa</string>
        <string name="text_field_remote_error">No data available</string>
 </resources>
index 04751af..ac012d9 100644 (file)
             android:entryValues="@array/weather_preferences_units_value"
             android:selectable="true"
             android:persistent="true"
-            android:defaultValue="Celsius" />
+            android:defaultValue="@string/weather_preferences_units_celsius" />
+        <ListPreference android:key="@string/weather_preferences_wind_key"
+            android:entryValues="@array/weather_preferences_wind_human_value"
+            android:entries="@array/weather_preferences_wind"
+            android:title="@string/weather_preferences_wind"/>
     </PreferenceCategory>
     <PreferenceCategory android:title="@string/weather_preferences_notifications">
         <SwitchPreference android:key="@string/weather_preferences_notifications_switch_key"
index 4d21465..7552c35 100644 (file)
@@ -202,6 +202,11 @@ public class CurrentFragment extends Fragment {
         super.onPause();
     }
 
+    private interface UnitsConversor {
+       
+       public double doConversion(final double value);
+    }
+    
     private void updateUI(final Current current) {
        
         final SharedPreferences sharedPreferences = PreferenceManager
@@ -209,19 +214,49 @@ public class CurrentFragment extends Fragment {
 
         // TODO: repeating the same code in Overview, Specific and Current!!!
         // 1. Update units of measurement.
-        boolean mIsFahrenheit = false;
-        final String keyPreference = this.getResources().getString(
-                R.string.weather_preferences_units_key);
-        final String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
-        final String celsius = this.getResources().getString(
-                R.string.weather_preferences_units_celsius);
-        if (unitsPreferenceValue.equals(celsius)) {
-            mIsFahrenheit = false;
+        // 1.1 Temperature
+        String tempSymbol;
+        UnitsConversor tempUnitsConversor;
+        String keyPreference = this.getResources().getString(R.string.weather_preferences_units_key);
+        String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
+        if (unitsPreferenceValue.equals(values[0])) {
+               tempSymbol = values[0];
+               tempUnitsConversor = new UnitsConversor(){
+
+                               @Override
+                               public double doConversion(final double value) {
+                                       return value - 273.15;
+                               }
+                       
+               };
+        } else if (unitsPreferenceValue.equals(values[1])) {
+               tempSymbol = values[1];
+               tempUnitsConversor = new UnitsConversor(){
+
+                               @Override
+                               public double doConversion(final double value) {
+                                       return (value * 1.8) - 459.67;
+                               }
+                       
+               };
         } else {
-            mIsFahrenheit = true;
+               tempSymbol = values[2];
+               tempUnitsConversor = new UnitsConversor(){
+
+                               @Override
+                               public double doConversion(final double value) {
+                                       return value;
+                               }
+                       
+               };
         }
-        final double tempUnits = mIsFahrenheit ? 0 : 273.15;
-        final String symbol = mIsFahrenheit ? "ºF" : "ºC";
+
+        // 1.2 Wind
+        keyPreference = this.getResources().getString(R.string.weather_preferences_wind_key);
+        final String windSymbol = sharedPreferences.getString(
+                       keyPreference,
+                       this.getResources().getStringArray(R.array.weather_preferences_wind)[0]);
 
 
         // 2. Formatters
@@ -234,14 +269,14 @@ public class CurrentFragment extends Fragment {
         String tempMax = "";
         if (current.getMain().getTemp_max() != null) {
             double conversion = (Double) current.getMain().getTemp_max();
-            conversion = conversion - tempUnits;
-            tempMax = tempFormatter.format(conversion) + symbol;
+            conversion = tempUnitsConversor.doConversion(conversion);
+            tempMax = tempFormatter.format(conversion) + tempSymbol;
         }
         String tempMin = "";
         if (current.getMain().getTemp_min() != null) {
             double conversion = (Double) current.getMain().getTemp_min();
-            conversion = conversion - tempUnits;
-            tempMin = tempFormatter.format(conversion) + symbol;
+            conversion = tempUnitsConversor.doConversion(conversion);
+            tempMin = tempFormatter.format(conversion) + tempSymbol;
         }
         Bitmap picture;
         if ((current.getWeather().size() > 0)
@@ -301,7 +336,7 @@ public class CurrentFragment extends Fragment {
         String feelsLike = "";
         if (current.getMain().getTemp() != null) {
             double conversion = (Double) current.getMain().getTemp();
-            conversion = conversion - tempUnits;
+            conversion = tempUnitsConversor.doConversion(conversion);
             feelsLike = tempFormatter.format(conversion);
         }
         String sunRiseTime = "";
@@ -349,8 +384,7 @@ public class CurrentFragment extends Fragment {
         ((TextView) getActivity().findViewById(R.id.weather_current_wind)).setText(
                        this.getActivity().getApplicationContext().getString(R.string.text_field_wind));
         ((TextView) getActivity().findViewById(R.id.weather_current_wind_value)).setText(windValue);
-        ((TextView) getActivity().findViewById(R.id.weather_current_wind_units)).setText(
-                       this.getActivity().getApplicationContext().getString(R.string.text_units_ms));
+        ((TextView) getActivity().findViewById(R.id.weather_current_wind_units)).setText(windSymbol);
         
         ((TextView) getActivity().findViewById(R.id.weather_current_rain)).setText(
                        this.getActivity().getApplicationContext().getString(R.string.text_field_rain));
@@ -373,8 +407,7 @@ public class CurrentFragment extends Fragment {
         ((TextView) getActivity().findViewById(R.id.weather_current_feelslike)).setText(
                        this.getActivity().getApplicationContext().getString(R.string.text_field_feels_like));
         ((TextView) getActivity().findViewById(R.id.weather_current_feelslike_value)).setText(feelsLike);
-        ((TextView) getActivity().findViewById(R.id.weather_current_feelslike_units)).setText(
-                       this.getActivity().getApplicationContext().getString(R.string.text_units_centigrade));
+        ((TextView) getActivity().findViewById(R.id.weather_current_feelslike_units)).setText(tempSymbol);
         
         ((TextView) getActivity().findViewById(R.id.weather_current_sunrise)).setText(
                        this.getActivity().getApplicationContext().getString(R.string.text_field_sun_rise));
@@ -406,6 +439,7 @@ public class CurrentFragment extends Fragment {
     
     private void clearUI() {
 
+       // TODO: something better than this for clearing view?
         ((TextView) getActivity().findViewById(R.id.weather_current_temp_max)).setText("");
         ((TextView) getActivity().findViewById(R.id.weather_current_temp_min)).setText("");
         
index f413122..c8a5bf6 100644 (file)
@@ -198,6 +198,11 @@ public class OverviewFragment extends ListFragment {
         }
     }
 
+    private interface UnitsConversor {
+       
+       public double doConversion(final double value);
+    }
+    
     private void updateUI(final Forecast forecastWeatherData) {
 
         final SharedPreferences sharedPreferences = PreferenceManager
@@ -205,27 +210,49 @@ public class OverviewFragment extends ListFragment {
 
         // TODO: repeating the same code in Overview, Specific and Current!!!
         // 1. Update units of measurement.
-        boolean isFahrenheit = false;
-        String keyPreference = this.getResources()
-                .getString(R.string.weather_preferences_units_key);
-        final String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "Celsius");
-        final String celsius = this.getResources().getString(
-                R.string.weather_preferences_units_celsius);
-        if (unitsPreferenceValue.equals(celsius)) {
-            isFahrenheit = false;
+        String symbol;
+        UnitsConversor unitsConversor;
+        String keyPreference = this.getResources().getString(
+                R.string.weather_preferences_units_key);
+        final String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
+        if (unitsPreferenceValue.equals(values[0])) {
+               symbol = values[0];
+               unitsConversor = new UnitsConversor(){
+
+                               @Override
+                               public double doConversion(final double value) {
+                                       return value - 273.15;
+                               }
+                       
+               };
+        } else if (unitsPreferenceValue.equals(values[1])) {
+               symbol = values[1];
+               unitsConversor = new UnitsConversor(){
+
+                               @Override
+                               public double doConversion(final double value) {
+                                       return (value * 1.8) - 459.67;
+                               }
+                       
+               };
         } else {
-            isFahrenheit = true;
+               symbol = values[2];
+               unitsConversor = new UnitsConversor(){
+
+                               @Override
+                               public double doConversion(final double value) {
+                                       return value;
+                               }
+                       
+               };
         }
-        final double tempUnits = isFahrenheit ? 0 : 273.15;
-        final String symbol = isFahrenheit ? "ºF" : "ºC";
 
 
         // 2. Update number day forecast.
-        int mDayForecast;
-        keyPreference = this.getResources()
-                .getString(R.string.weather_preferences_day_forecast_key);
+        keyPreference = this.getResources().getString(R.string.weather_preferences_day_forecast_key);
         final String dayForecast = sharedPreferences.getString(keyPreference, "5");
-        mDayForecast = Integer.valueOf(dayForecast);
+        final int mDayForecast = Integer.valueOf(dayForecast);
 
 
         // 3. Formatters
@@ -266,13 +293,13 @@ public class OverviewFragment extends ListFragment {
             Double maxTemp = null;
             if (forecast.getTemp().getMax() != null) {
                 maxTemp = (Double) forecast.getTemp().getMax();
-                maxTemp = maxTemp - tempUnits;
+                maxTemp = unitsConversor.doConversion(maxTemp);
             }
 
             Double minTemp = null;
             if (forecast.getTemp().getMin() != null) {
                 minTemp = (Double) forecast.getTemp().getMin();
-                minTemp = minTemp - tempUnits;
+                minTemp = unitsConversor.doConversion(minTemp);
             }
 
             if ((maxTemp != null) && (minTemp != null)) {
index 1315c88..6ad22ba 100644 (file)
@@ -24,22 +24,33 @@ public class WeatherInformationPreferencesFragment extends PreferenceFragment
         this.addPreferencesFromResource(R.xml.weather_preferences);
         
         
-        // Units of Measurement
+        // Temperature units
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
+        String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_units_human_value);
         String keyPreference = this.getActivity().getApplicationContext().getString(
                 R.string.weather_preferences_units_key);
         Preference connectionPref = this.findPreference(keyPreference);
-        connectionPref.setSummary(this.getPreferenceManager()
-                .getSharedPreferences().getString(keyPreference, ""));
+        String value = this.getPreferenceManager().getSharedPreferences()
+                .getString(keyPreference, "");
+        String humanValue = "";
+        if (value.equals(values[0])) {
+            humanValue = humanValues[0];
+        } else if (value.equals(values[1])) {
+            humanValue = humanValues[1];
+        } else if (value.equals(values[2])) {
+            humanValue = humanValues[2];
+        }
+        connectionPref.setSummary(humanValue);
         
         // Update Time Rate
-        String[] values = this.getResources().getStringArray(R.array.weather_preferences_update_time_rate);
-        String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_update_time_rate_human_value);
+        values = this.getResources().getStringArray(R.array.weather_preferences_update_time_rate);
+        humanValues = this.getResources().getStringArray(R.array.weather_preferences_update_time_rate_human_value);
         keyPreference = this.getActivity().getApplicationContext().getString(
                 R.string.weather_preferences_update_time_rate_key);
         connectionPref = this.findPreference(keyPreference);
-        String value = this.getPreferenceManager().getSharedPreferences()
+        value = this.getPreferenceManager().getSharedPreferences()
                 .getString(keyPreference, "");
-        String humanValue = "";
+        humanValue = "";
         if (value.equals(values[0])) {
             humanValue = humanValues[0];
         } else if (value.equals(values[1])) {
index 0a4cc93..f223018 100644 (file)
@@ -103,7 +103,11 @@ public class SpecificFragment extends Fragment {
         }
     }
 
-
+    private interface UnitsConversor {
+       
+       public double doConversion(final double value);
+    }
+    
     private void updateUI(final Forecast forecastWeatherData, final int chosenDay) {
 
         final SharedPreferences sharedPreferences = PreferenceManager
@@ -111,21 +115,52 @@ public class SpecificFragment extends Fragment {
 
         // TODO: repeating the same code in Overview, Specific and Current!!!
         // 1. Update units of measurement.
-        boolean isFahrenheit = false;
-        final String keyPreference = this.getResources().getString(
+        // 1.1 Temperature
+        String tempSymbol;
+        UnitsConversor tempUnitsConversor;
+        String keyPreference = this.getResources().getString(
                 R.string.weather_preferences_units_key);
         final String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
-        final String celsius = this.getResources().getString(
-                R.string.weather_preferences_units_celsius);
-        if (unitsPreferenceValue.equals(celsius)) {
-            isFahrenheit = false;
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
+        if (unitsPreferenceValue.equals(values[0])) {
+               tempSymbol = values[0];
+               tempUnitsConversor = new UnitsConversor(){
+
+                               @Override
+                               public double doConversion(final double value) {
+                                       return value - 273.15;
+                               }
+                       
+               };
+        } else if (unitsPreferenceValue.equals(values[1])) {
+               tempSymbol = values[1];
+               tempUnitsConversor = new UnitsConversor(){
+
+                               @Override
+                               public double doConversion(final double value) {
+                                       return (value * 1.8) - 459.67;
+                               }
+                       
+               };
         } else {
-            isFahrenheit = true;
+               tempSymbol = values[2];
+               tempUnitsConversor = new UnitsConversor(){
+
+                               @Override
+                               public double doConversion(final double value) {
+                                       return value;
+                               }
+                       
+               };
         }
-        final double tempUnits = isFahrenheit ? 0 : 273.15;
-        final String symbol = isFahrenheit ? "ºF" : "ºC";
-       
-        
+
+        // 1.2 Wind
+        keyPreference = this.getResources().getString(R.string.weather_preferences_wind_key);
+        final String windSymbol = sharedPreferences.getString(
+                       keyPreference,
+                       this.getResources().getStringArray(R.array.weather_preferences_wind)[0]);
+
+
         // 2. Formatters
         final DecimalFormat tempFormatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US);
         tempFormatter.applyPattern("#####.#####");
@@ -144,14 +179,14 @@ public class SpecificFragment extends Fragment {
         String tempMax = "";
         if (forecast.getTemp().getMax() != null) {
             double conversion = (Double) forecast.getTemp().getMax();
-            conversion = conversion - tempUnits;
-            tempMax = tempFormatter.format(conversion) + symbol;
+            conversion = tempUnitsConversor.doConversion(conversion);
+            tempMax = tempFormatter.format(conversion) + tempSymbol;
         }        
         String tempMin = "";
         if (forecast.getTemp().getMin() != null) {
             double conversion = (Double) forecast.getTemp().getMin();
-            conversion = conversion - tempUnits;
-            tempMin = tempFormatter.format(conversion) + symbol;
+            conversion = tempUnitsConversor.doConversion(conversion);
+            tempMin = tempFormatter.format(conversion) + tempSymbol;
         }
         Bitmap picture;
         if ((forecast.getWeather().size() > 0) && (forecast.getWeather().get(0).getIcon() != null)
@@ -200,26 +235,26 @@ public class SpecificFragment extends Fragment {
         String tempDay = "";
         if (forecast.getTemp().getDay() != null) {
             double conversion = (Double) forecast.getTemp().getDay();
-            conversion = conversion - tempUnits;
-            tempDay = tempFormatter.format(conversion) + symbol;
+            conversion = tempUnitsConversor.doConversion(conversion);
+            tempDay = tempFormatter.format(conversion) + tempSymbol;
         }
         String tempMorn = "";
         if (forecast.getTemp().getMorn() != null) {
             double conversion = (Double) forecast.getTemp().getMorn();
-            conversion = conversion - tempUnits;
-            tempMorn = tempFormatter.format(conversion) + symbol;
+            conversion = tempUnitsConversor.doConversion(conversion);
+            tempMorn = tempFormatter.format(conversion) + tempSymbol;
         }
         String tempEve = "";
         if (forecast.getTemp().getEve() != null) {
             double conversion = (Double) forecast.getTemp().getEve();
-            conversion = conversion - tempUnits;
-            tempEve = tempFormatter.format(conversion) + symbol;
+            conversion = tempUnitsConversor.doConversion(conversion);
+            tempEve = tempFormatter.format(conversion) + tempSymbol;
         }   
         String tempNight = "";
         if (forecast.getTemp().getNight() != null) {
             double conversion = (Double) forecast.getTemp().getNight();
-            conversion = conversion - tempUnits;
-            tempNight = tempFormatter.format(conversion) + symbol;
+            conversion = tempUnitsConversor.doConversion(conversion);
+            tempNight = tempFormatter.format(conversion) + tempSymbol;
         }   
 
 
@@ -240,8 +275,8 @@ public class SpecificFragment extends Fragment {
         humidityValueView.setText(humidityValue);
         final TextView pressureValueView = (TextView) getActivity().findViewById(R.id.weather_specific_pressure_value);
         pressureValueView.setText(pressureValue);
-        final TextView windValueView = (TextView) getActivity().findViewById(R.id.weather_specific_wind_value);
-        windValueView.setText(windValue);
+        ((TextView) getActivity().findViewById(R.id.weather_specific_wind_value)).setText(windValue);;
+        ((TextView) getActivity().findViewById(R.id.weather_specific_wind_units)).setText(windSymbol);
         final TextView rainValueView = (TextView) getActivity().findViewById(R.id.weather_specific_rain_value);
         rainValueView.setText(rainValue);
         final TextView cloudsValueView = (TextView) getActivity().findViewById(R.id.weather_specific_clouds_value);