Weather app android: current data information.
authorgu.martinm@gmail.com <gu.martinm@gmail.com>
Sun, 20 Apr 2014 16:08:14 +0000 (18:08 +0200)
committergu.martinm@gmail.com <gu.martinm@gmail.com>
Sun, 20 Apr 2014 16:08:14 +0000 (18:08 +0200)
12 files changed:
gen/.gitignore
res/layout/weather_current_data.xml
res/layout/weather_current_data_entry_fifth.xml [new file with mode: 0644]
res/layout/weather_current_data_entry_fourth.xml
res/layout/weather_current_data_entry_third.xml
src/de/example/exampletdd/fragment/current/WeatherCurrentDataAdapter.java [new file with mode: 0644]
src/de/example/exampletdd/fragment/current/WeatherCurrentDataEntryFifth.java [new file with mode: 0644]
src/de/example/exampletdd/fragment/current/WeatherCurrentDataEntryFirst.java [new file with mode: 0644]
src/de/example/exampletdd/fragment/current/WeatherCurrentDataEntrySecond.java [new file with mode: 0644]
src/de/example/exampletdd/fragment/current/WeatherInformationCurrentDataFragment.java
src/de/example/exampletdd/fragment/overview/WeatherInformationOverviewFragment.java
src/de/example/exampletdd/fragment/specific/WeatherInformationSpecificDataFragment.java

index d4ffb9e..b6c80c1 100644 (file)
@@ -1,2 +1,3 @@
 /com
 /de
+/.gitignore
index 0f581a6..f4b3aad 100644 (file)
@@ -9,14 +9,6 @@
     tools:context="de.example.exampletdd.WeatherInformationCurrentDataActivity"
     tools:ignore="MergeRootFrame" >
 
-    <ImageView
-        android:id="@+id/weather_current_picture"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:contentDescription="@string/icon_weather_description"
-        android:scaleType="fitCenter"
-        android:src="@drawable/ic_launcher" />
-
      <fragment
         android:id="@+id/weather_current_data_fragment"
         android:layout_width="match_parent"
diff --git a/res/layout/weather_current_data_entry_fifth.xml b/res/layout/weather_current_data_entry_fifth.xml
new file mode 100644 (file)
index 0000000..27c67d2
--- /dev/null
@@ -0,0 +1,456 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:gravity="center"
+    android:layout_gravity="center"
+    android:orientation="vertical" >
+   
+    <LinearLayout
+        android:baselineAligned="false"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_gravity="center_horizontal"
+    android:orientation="horizontal" >
+    
+        <LinearLayout
+    android:layout_width="0dp"
+    android:layout_weight="1"
+    android:layout_height="wrap_content"
+    android:gravity="center"
+    android:layout_gravity="center"
+    android:orientation="vertical" >
+    
+            <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:gravity="center_horizontal"
+        android:orientation="horizontal" >
+            <!-- Feels like temperature -->
+        <TextView
+            android:id="@+id/weather_current_now_data_feelslike"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="FEELS LIKE"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:textAlignment="textStart"
+            android:textColor="@color/weather_time_of_day_color_title"
+            android:layout_margin="5dp"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold" />
+        
+        <!-- Feels like temperature Value-->
+        <TextView
+            android:id="@+id/weather_current_now_data_feelslike_value"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="55"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="normal" />
+        
+        <!-- Feels like temperature Units-->
+        <TextView
+            android:id="@+id/weather_current_now_data_feelslike_units"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text=" ºC"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold" />
+        
+     </LinearLayout>
+    
+            <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:orientation="horizontal" >
+    <!-- Humidity -->
+
+        <TextView
+            android:id="@+id/weather_current_now_data_humidity"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="left"
+            android:layout_margin="5dp"
+            android:gravity="left"
+            android:text="HUMIDITY"
+            android:textAlignment="textStart"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="@color/weather_time_of_day_color_title"
+            android:textStyle="bold" />
+        
+        <!-- Humidity Value-->
+        <TextView
+            android:id="@+id/weather_current_now_data_humidity_value"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="83"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="normal" />
+        
+        <!-- Humidity Units-->
+        <TextView
+            android:id="@+id/weather_current_now_data_humidity_units"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="%"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold" />
+                </LinearLayout>
+                
+            <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:orientation="horizontal" >
+                <!-- Rain -->
+        <TextView
+            android:id="@+id/weather_current_now_data_rain"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="RAIN"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:textAlignment="textStart"
+            android:textColor="@color/weather_time_of_day_color_title"
+            android:layout_margin="5dp"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold" />
+          
+        <!-- Rain Value-->
+        <TextView
+            android:id="@+id/weather_current_now_data_rain_value"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="1.24"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:textAlignment="textStart"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="normal" />
+        
+        <!-- Rain Units -->
+        <TextView
+            android:id="@+id/weather_current_now_data_rain_units"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text=" mm 3h"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
+            android:textAlignment="textStart"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold" />
+                </LinearLayout>
+    
+            </LinearLayout>
+            
+        <LinearLayout
+    android:layout_width="0dp"
+    android:layout_weight="1"
+    android:layout_height="wrap_content"
+    android:gravity="center"
+    android:layout_gravity="center"
+    android:orientation="vertical" >
+            
+            <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:orientation="horizontal" >
+            <!-- Snow -->
+        <TextView
+            android:id="@+id/weather_current_now_data_snow"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="SNOW"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:textColor="@color/weather_time_of_day_color_title"
+            android:layout_margin="5dp"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold" />
+        
+        <!-- Snow Value-->
+        <TextView
+            android:id="@+id/weather_current_now_data_snow_value"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="1.22"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="normal" />
+        
+        <!-- Snow Units-->
+        <TextView
+            android:id="@+id/weather_current_now_data_snow_units"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text=" mm 3h"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold" />
+        
+     </LinearLayout>
+     
+            <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:orientation="horizontal" >
+         <!-- Wind -->
+        <TextView
+            android:id="@+id/weather_current_now_data_wind"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="WIND"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:textColor="@color/weather_time_of_day_color_title"
+            android:layout_margin="5dp"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold" />
+        
+        <!-- Wind Value-->
+        <TextView
+            android:id="@+id/weather_current_now_data_wind_value"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="6.36"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="normal" />
+        
+        <!-- Wind Units -->
+        <TextView
+            android:id="@+id/weather_current_now_data_wind_units"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text=" m/s"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold" />
+        </LinearLayout>
+        
+            <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:orientation="horizontal" >
+                <!-- Clouds -->
+        <TextView
+            android:id="@+id/weather_current_now_data_clouds"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="CLOUDS"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:textColor="@color/weather_time_of_day_color_title"
+            android:layout_margin="5dp"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold" />
+        
+        <!-- Clouds Value-->
+        <TextView
+            android:id="@+id/weather_current_now_data_clouds_value"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="6.36"
+            android:layout_gravity="right"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="normal" />
+        
+        
+        <!-- Clouds Units -->
+        <TextView
+            android:id="@+id/weather_current_now_data_clouds_units"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="%"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold" />
+            </LinearLayout>
+            </LinearLayout>
+    
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:gravity="center_horizontal"
+        android:orientation="horizontal" >
+        
+        <!-- Pressure -->
+        <TextView
+            android:id="@+id/weather_current_now_data_pressure"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="PRESSURE"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:textAlignment="textStart"
+            android:textColor="@color/weather_time_of_day_color_title"
+            android:layout_margin="5dp"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold" />
+        
+        <!-- Pressure Value-->
+        <TextView
+            android:id="@+id/weather_current_now_data_pressure_value"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="1036.05"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="normal" />
+        
+        <!-- Pressure Units-->
+        <TextView
+            android:id="@+id/weather_current_now_data_pressure_units"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text=" hpa"
+            android:layout_gravity="left"
+            android:gravity="left"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold" />
+        
+     </LinearLayout>
+     
+        <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:gravity="center"
+    android:layout_gravity="center"
+    android:orientation="horizontal" >
+    <TextView
+        android:id="@+id/weather_current_now_data_sunrise"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="left"
+        android:gravity="left"
+        android:textAlignment="textStart"
+        android:layout_margin="5dp"
+        android:text="SUN RISE"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="@color/weather_time_of_day_color_title"
+        android:textStyle="bold" />
+    
+    <TextView
+        android:id="@+id/weather_current_now_data_sunrise_value"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="left"
+        android:gravity="left"
+        android:textAlignment="textStart"
+        android:layout_marginTop="5dp"
+        android:layout_marginBottom="5dp"
+        android:text="2014.04.20 10:29:33"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textStyle="normal" />
+    
+    </LinearLayout>
+    
+    <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:gravity="center"
+    android:layout_gravity="center"
+    android:orientation="horizontal" >
+    
+    <TextView
+        android:id="@+id/weather_current_now_data_sunset"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="right"
+        android:gravity="right"
+        android:textAlignment="textStart"
+        android:layout_margin="5dp"
+        android:text="SUN SET"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="@color/weather_time_of_day_color_title"
+        android:textStyle="bold" />
+    
+    <TextView
+        android:id="@+id/weather_current_now_data_sunset_value"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="right"
+        android:gravity="right"
+        android:textAlignment="textStart"
+        android:layout_marginTop="5dp"
+        android:layout_marginBottom="5dp"
+        android:text="2014.04.20 10:29:33"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textStyle="normal" />
+    </LinearLayout>
+</LinearLayout>
index 19d3488..d5a3207 100644 (file)
                 android:layout_height="wrap_content"
                 android:orientation="vertical">
 
-                <!-- Thermometer -->
-                <ImageView
-                    android:id="@+id/thermometer_morn"
-                    android:layout_width="wrap_content"
-                    android:layout_height="fill_parent"
-                    android:layout_below="@+id/weather_morn"
-                    android:layout_alignParentLeft="true"
-                    android:orientation="vertical"
-                    android:contentDescription="Image"
-                    android:src="@drawable/thermometer"
-                    android:background="?android:attr/activatedBackgroundIndicator"/>
-
                 <!-- Temperature -->
                 <TextView
                     android:id="@+id/weather_morn_temperature"
@@ -36,8 +24,7 @@
                     android:textAlignment="center"
                     android:gravity="center|center_vertical"
                     android:layout_below="@+id/weather_morn"
-                    android:layout_toRightOf="@id/thermometer_morn"
-                    android:layout_alignTop="@id/thermometer_morn"
+                    android:layout_centerInParent="true"
                     android:textAppearance="?android:attr/textAppearanceMedium"
                     android:textStyle="bold" />
 
@@ -51,6 +38,7 @@
                     android:textAlignment="center"
                     android:gravity="center"
                     android:layout_alignParentTop="true"
+                    android:layout_centerInParent="true"
                     android:textAppearance="?android:attr/textAppearanceMedium" />
 
             </RelativeLayout>
             android:layout_height="wrap_content"
             android:orientation="vertical">
             
-            <!-- Thermometer -->
-            <ImageView
-                android:id="@+id/thermometer_day"
-                android:layout_width="wrap_content"
-                android:layout_height="fill_parent"
-                android:layout_below="@+id/weather_day"
-                android:layout_alignParentLeft="true"
-                android:orientation="vertical"
-                android:contentDescription="Image"
-                android:src="@drawable/thermometer"
-                android:background="?android:attr/activatedBackgroundIndicator"/>
             
             <!-- Temperature -->
             <TextView
@@ -81,8 +58,7 @@
                  android:textAlignment="center"
                  android:gravity="center|center_vertical"
                  android:layout_below="@+id/weather_day"
-                 android:layout_toRightOf="@id/thermometer_day"
-                 android:layout_alignTop="@id/thermometer_day"
+                 android:layout_centerInParent="true"
                  android:textAppearance="?android:attr/textAppearanceMedium"
                  android:textStyle="bold" />
 
@@ -92,6 +68,7 @@
                  android:layout_width="140dp"
                  android:layout_height="wrap_content"
                  android:layout_alignParentTop="true"
+                 android:layout_centerInParent="true"
                  android:gravity="center"
                  android:selectAllOnFocus="true"
                  android:text="DAY"
                 android:layout_height="wrap_content"
                 android:orientation="vertical">
 
-                <!-- Thermometer -->
-                <ImageView
-                    android:id="@+id/thermometer_eve"
-                    android:layout_width="wrap_content"
-                    android:layout_height="fill_parent"
-                    android:layout_below="@+id/weather_eve"
-                    android:layout_alignParentLeft="true"
-                    android:orientation="vertical"
-                    android:contentDescription="Image"
-                    android:src="@drawable/thermometer"
-                    android:background="?android:attr/activatedBackgroundIndicator"/>
+
 
                 <!-- Temperature -->
                 <TextView
                     android:textAlignment="center"
                     android:gravity="center|center_vertical"
                     android:layout_below="@+id/weather_eve"
-                    android:layout_toRightOf="@id/thermometer_eve"
-                    android:layout_alignTop="@id/thermometer_eve"
+                    android:layout_centerInParent="true"
                     android:textAppearance="?android:attr/textAppearanceMedium"
                     android:textStyle="bold" />
 
                     android:text="EVENING"
                     android:textColor="@color/weather_time_of_day_color_title"
                     android:textAlignment="center"
+                    android:layout_centerInParent="true"
                     android:gravity="center"
                     android:layout_alignParentTop="true"
                     android:textAppearance="?android:attr/textAppearanceMedium" />
                 android:layout_height="wrap_content"
                 android:orientation="vertical">
 
-                <!-- Thermometer -->
-                <ImageView
-                    android:id="@+id/thermometer_night"
-                    android:layout_width="wrap_content"
-                    android:layout_height="fill_parent"
-                    android:layout_below="@+id/weather_night"
-                    android:layout_alignParentLeft="true"
-                    android:orientation="vertical"
-                    android:contentDescription="Image"
-                    android:src="@drawable/thermometer"
-                    android:background="?android:attr/activatedBackgroundIndicator"/>
 
                 <!-- Temperature -->
                 <TextView
                     android:textAlignment="center"
                     android:gravity="center|center_vertical"
                     android:layout_below="@+id/weather_night"
-                    android:layout_toRightOf="@id/thermometer_night"
-                    android:layout_alignTop="@id/thermometer_night"
+                    android:layout_centerInParent="true"
                     android:textAppearance="?android:attr/textAppearanceMedium"
                     android:textStyle="bold" />
 
                     android:textAlignment="center"
                     android:gravity="center"
                     android:layout_alignParentTop="true"
+                    android:layout_centerInParent="true"
                     android:textAppearance="?android:attr/textAppearanceMedium" />
 
             </RelativeLayout>
index 9f7094c..fa78a65 100644 (file)
@@ -6,25 +6,40 @@
     android:layout_gravity="center"
     android:orientation="vertical" >
 
-    <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:padding="20dp"
-        android:orientation="vertical" >
+    <LinearLayout
+        android:baselineAligned="false"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_gravity="center_horizontal"
+    android:paddingTop="20dp"
+    android:orientation="horizontal" >
+    
+        <LinearLayout
+    android:layout_width="0dp"
+    android:layout_weight="1"
+    android:layout_height="wrap_content"
+    android:gravity="center"
+    android:layout_gravity="center"
+    android:orientation="vertical" >
+    
+            <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:orientation="horizontal" >
+    <!-- Humidity -->
 
-        <!-- Humidity -->
         <TextView
             android:id="@+id/weather_current_data_humidity"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="HUMIDITY"
             android:layout_gravity="left"
-            android:gravity="left"
-            android:layout_alignParentLeft="true"
-            android:textAlignment="center"
-            android:textColor="@color/weather_time_of_day_color_title"
             android:layout_margin="5dp"
+            android:gravity="left"
+            android:text="HUMIDITY"
+            android:textAlignment="textStart"
             android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="@color/weather_time_of_day_color_title"
             android:textStyle="bold" />
         
         <!-- Humidity Value-->
@@ -35,9 +50,9 @@
             android:text="83"
             android:layout_gravity="left"
             android:gravity="left"
-            android:layout_toRightOf="@+id/weather_current_data_humidity"
-            android:textAlignment="center"
+            android:textAlignment="textStart"
             android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textStyle="normal" />
         
             android:text="%"
             android:layout_gravity="left"
             android:gravity="left"
-            android:textAlignment="center"
-            android:layout_toRightOf="@+id/weather_current_data_humidity_value"
-            android:paddingTop="5dp"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textStyle="bold" />
-            
-        <!-- Wind -->
-        <TextView
-            android:id="@+id/weather_current_data_wind"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="WIND"
-            android:layout_gravity="right"
-            android:gravity="right"
-            android:layout_alignParentRight="true"
-            android:textAlignment="center"
-            android:textColor="@color/weather_time_of_day_color_title"
-            android:layout_margin="5dp"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textStyle="bold" />
-        
-        <!-- Wind Units -->
-        <TextView
-            android:id="@+id/weather_current_data_wind_units"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text=" m/s"
-            android:layout_gravity="right"
-            android:gravity="right"
-            android:layout_toLeftOf="@+id/weather_current_data_wind"
-            android:textAlignment="center"
+            android:textAlignment="textStart"
             android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textStyle="bold" />
-        
-        <!-- Wind Value-->
-        <TextView
-            android:id="@+id/weather_current_data_wind_value"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="6.36"
-            android:layout_gravity="right"
-            android:gravity="right"
-            android:layout_toLeftOf="@+id/weather_current_data_wind_units"
-            android:textAlignment="center"
-            android:layout_marginTop="5dp"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textStyle="normal" />
-        
-       
-        
-    </RelativeLayout>
-    
-    
-        <RelativeLayout
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:padding="20dp"
-        android:orientation="vertical" >
-        
-        <!-- Rain -->
+                </LinearLayout>
+                
+            <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:orientation="horizontal" >
+                <!-- Rain -->
         <TextView
             android:id="@+id/weather_current_data_rain"
             android:layout_width="wrap_content"
             android:text="RAIN"
             android:layout_gravity="left"
             android:gravity="left"
-            android:layout_alignParentLeft="true"
-            android:textAlignment="center"
+            android:textAlignment="textStart"
             android:textColor="@color/weather_time_of_day_color_title"
-            android:paddingTop="20dp"
-            android:paddingBottom="20dp"
             android:layout_margin="5dp"
             android:textAppearance="?android:attr/textAppearanceMedium"
             android:textStyle="bold" />
             android:text="1.24"
             android:layout_gravity="left"
             android:gravity="left"
-            android:textAlignment="center"
-            android:layout_toRightOf="@+id/weather_current_data_rain"
-            android:paddingTop="20dp"
-            android:paddingBottom="20dp"
             android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:textAlignment="textStart"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textStyle="normal" />
         
             android:text=" mm 3h"
             android:layout_gravity="left"
             android:gravity="left"
-            android:textAlignment="center"
-            android:layout_toRightOf="@+id/weather_current_data_rain_value"
-            android:paddingTop="20dp"
-            android:paddingRight="20dp"
-            android:paddingBottom="20dp"
             android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
+            android:textAlignment="textStart"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textStyle="bold" />
-        
-        
-        <!-- Clouds -->
+                </LinearLayout>
+    
+            </LinearLayout>
+            
+        <LinearLayout
+    android:layout_width="0dp"
+    android:layout_weight="1"
+    android:layout_height="wrap_content"
+    android:gravity="center"
+    android:layout_gravity="center"
+    android:orientation="vertical" >
+            <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:orientation="horizontal" >
+         <!-- Wind -->
         <TextView
-            android:id="@+id/weather_current_data_clouds"
+            android:id="@+id/weather_current_data_wind"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="CLOUDS"
+            android:text="WIND"
             android:layout_gravity="right"
             android:gravity="right"
-            android:layout_alignParentRight="true"
-            android:textAlignment="center"
+            android:textAlignment="textStart"
             android:textColor="@color/weather_time_of_day_color_title"
-            android:paddingTop="20dp"
-            android:paddingBottom="20dp"
             android:layout_margin="5dp"
             android:textAppearance="?android:attr/textAppearanceMedium"
             android:textStyle="bold" />
         
-        <!-- Clouds Units -->
+        <!-- Wind Value-->
         <TextView
-            android:id="@+id/weather_current_data_clouds_units"
+            android:id="@+id/weather_current_data_wind_value"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="%"
+            android:text="6.36"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="normal" />
+        
+        <!-- Wind Units -->
+        <TextView
+            android:id="@+id/weather_current_data_wind_units"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text=" m/s"
             android:layout_gravity="right"
             android:gravity="right"
-            android:layout_toLeftOf="@+id/weather_current_data_clouds"
-            android:textAlignment="center"
-            android:paddingTop="20dp"
-            android:paddingBottom="20dp"
+            android:textAlignment="textStart"
             android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textStyle="bold" />
+        </LinearLayout>
+        
+            <LinearLayout
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center_horizontal"
+    android:orientation="horizontal" >
+                <!-- Clouds -->
+        <TextView
+            android:id="@+id/weather_current_data_clouds"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="CLOUDS"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:textColor="@color/weather_time_of_day_color_title"
+            android:layout_margin="5dp"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold" />
         
         <!-- Clouds Value-->
         <TextView
             android:layout_height="wrap_content"
             android:text="6.36"
             android:layout_gravity="right"
-            android:gravity="right"
-            android:layout_toLeftOf="@+id/weather_current_data_clouds_units"
-            android:textAlignment="center"
-            android:paddingTop="20dp"
-            android:paddingBottom="20dp"
             android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:gravity="right"
+            android:textAlignment="textStart"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textStyle="normal" />
         
-     </RelativeLayout>
+        
+        <!-- Clouds Units -->
+        <TextView
+            android:id="@+id/weather_current_data_clouds_units"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="%"
+            android:layout_gravity="right"
+            android:gravity="right"
+            android:textAlignment="textStart"
+            android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold" />
+            </LinearLayout>
+            </LinearLayout>
     
+    </LinearLayout>
+
     <LinearLayout
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:gravity="center"
-    android:layout_gravity="center"
-    android:orientation="horizontal" >
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:gravity="center_horizontal"
+        android:paddingBottom="20dp"
+        android:orientation="horizontal" >
         
         <!-- Pressure -->
         <TextView
             android:text="PRESSURE"
             android:layout_gravity="left"
             android:gravity="left"
-            android:textAlignment="center"
+            android:textAlignment="textStart"
             android:textColor="@color/weather_time_of_day_color_title"
-            android:paddingTop="20dp"
-            android:paddingLeft="20dp"
-            android:paddingBottom="20dp"
             android:layout_margin="5dp"
             android:textAppearance="?android:attr/textAppearanceMedium"
             android:textStyle="bold" />
             android:text="1036.05"
             android:layout_gravity="left"
             android:gravity="left"
-            android:textAlignment="center"
-            android:paddingTop="20dp"
-            android:paddingBottom="20dp"
+            android:textAlignment="textStart"
             android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textStyle="normal" />
         
             android:text=" hpa"
             android:layout_gravity="left"
             android:gravity="left"
-            android:textAlignment="center"
-            android:paddingTop="20dp"
-            android:paddingRight="20dp"
-            android:paddingBottom="20dp"
+            android:textAlignment="textStart"
             android:layout_marginTop="5dp"
+            android:layout_marginBottom="5dp"
+            android:layout_marginRight="5dp"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textStyle="bold" />
         
diff --git a/src/de/example/exampletdd/fragment/current/WeatherCurrentDataAdapter.java b/src/de/example/exampletdd/fragment/current/WeatherCurrentDataAdapter.java
new file mode 100644 (file)
index 0000000..78301bd
--- /dev/null
@@ -0,0 +1,204 @@
+package de.example.exampletdd.fragment.current;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+import de.example.exampletdd.R;
+
+public class WeatherCurrentDataAdapter extends ArrayAdapter<Object> {
+    private static final int FIRST = 0;
+    private static final int SECOND = 1;
+    private static final int THIRD = 2;
+    private final int[] resources;
+
+    public WeatherCurrentDataAdapter(final Context context, final int[] resources) {
+        super(context, 0);
+
+        this.resources = resources;
+    }
+
+
+    @Override
+    public View getView(final int position, final View convertView, final ViewGroup parent) {
+
+        final View view = this.getWorkingView(position, convertView);
+        final int viewType = this.getItemViewType(position);
+
+        if (viewType == FIRST) {
+
+            final ViewFirstHolder viewHolder = this.getViewFirstHolder(view);
+            final WeatherCurrentDataEntryFirst entry = (WeatherCurrentDataEntryFirst) this
+                    .getItem(position);
+            viewHolder.picture.setImageBitmap(entry.getPicture());
+            viewHolder.tempMax.setText(entry.getTempMax());
+            viewHolder.tempMin.setText(entry.getTempMin());
+        } else if (viewType == SECOND) {
+            final ViewSecondHolder viewHolder = this.getViewSecondHolder(view);
+            final WeatherCurrentDataEntrySecond entry = (WeatherCurrentDataEntrySecond) this
+                    .getItem(position);
+            viewHolder.weatherDescription.setText(entry.getWeatherDescription());
+        } else if (viewType == THIRD) {
+            final ViewThirdHolder viewHolder = this.getViewThirdHolder(view);
+            final WeatherCurrentDataEntryFifth entry = (WeatherCurrentDataEntryFifth) this
+                    .getItem(position);
+            viewHolder.humidityValue.setText(entry.getHumidityValue());
+            viewHolder.pressureValue.setText(entry.getPressureValue());
+            viewHolder.rainValue.setText(entry.getRainValue());
+            viewHolder.cloudsValue.setText(entry.getCloudsValue());
+            viewHolder.windValue.setText(entry.getWindValue());
+            viewHolder.sunRiseTime.setText(entry.getSunRiseTime());
+            viewHolder.sunSetTime.setText(entry.getSunSetTime());
+            viewHolder.feelsLike.setText(entry.getFeelsLike());
+            viewHolder.snowValue.setText(entry.getSnowValue());
+            viewHolder.feelsLikeUnits.setText(entry.getFeelsLikeUnits());
+        }
+
+        return view;
+    }
+
+    @Override
+    public int getItemViewType(final int position) {
+        int type = 0;
+
+        if (position == 0) {
+            type = FIRST;
+        } else if (position == 1) {
+            type = SECOND;
+        } else if (position == 2) {
+            type = THIRD;
+        }
+
+        return type;
+    }
+
+    @Override
+    public int getViewTypeCount() {
+        return 3;
+    }
+
+    private View getWorkingView(final int position, final View convertView) {
+        View workingView = null;
+
+        if (convertView == null) {
+            final int viewType = this.getItemViewType(position);
+            final Context context = this.getContext();
+            final LayoutInflater inflater = (LayoutInflater) context
+                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+            workingView = inflater.inflate(this.resources[viewType], null);
+        } else {
+            workingView = convertView;
+        }
+
+        return workingView;
+    }
+
+    private ViewFirstHolder getViewFirstHolder(final View workingView) {
+        final Object tag = workingView.getTag();
+        ViewFirstHolder viewHolder = null;
+
+        if ((null == tag) || !(tag instanceof ViewFirstHolder)) {
+            viewHolder = new ViewFirstHolder();
+
+            viewHolder.picture = (ImageView) workingView
+                    .findViewById(R.id.weather_current_data_picture);
+            viewHolder.tempMax = (TextView) workingView
+                    .findViewById(R.id.weather_current_data_temp_max);
+            viewHolder.tempMin = (TextView) workingView
+                    .findViewById(R.id.weather_current_data_temp_min);
+
+            workingView.setTag(viewHolder);
+
+        } else {
+            viewHolder = (ViewFirstHolder) tag;
+        }
+
+        return viewHolder;
+    }
+
+    private ViewSecondHolder getViewSecondHolder(final View workingView) {
+        final Object tag = workingView.getTag();
+        ViewSecondHolder viewHolder = null;
+
+        if ((null == tag) || !(tag instanceof ViewSecondHolder)) {
+            viewHolder = new ViewSecondHolder();
+
+            viewHolder.weatherDescription = (TextView) workingView
+                    .findViewById(R.id.weather_current_data_description);
+
+            workingView.setTag(viewHolder);
+
+        } else {
+            viewHolder = (ViewSecondHolder) tag;
+        }
+
+        return viewHolder;
+    }
+
+    private ViewThirdHolder getViewThirdHolder(final View workingView) {
+        final Object tag = workingView.getTag();
+        ViewThirdHolder viewHolder = null;
+
+        if ((null == tag) || !(tag instanceof ViewThirdHolder)) {
+            viewHolder = new ViewThirdHolder();
+
+            viewHolder.humidityValue = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_humidity_value);
+            viewHolder.pressureValue = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_pressure_value);
+            viewHolder.rainValue = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_rain_value);
+            viewHolder.cloudsValue = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_clouds_value);
+            viewHolder.windValue = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_wind_value);
+            viewHolder.cloudsValue = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_clouds_value);
+            viewHolder.snowValue = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_snow_value);
+            viewHolder.sunRiseTime = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_sunrise_value);
+            viewHolder.sunSetTime = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_sunset_value);
+            viewHolder.feelsLike = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_feelslike_value);
+            viewHolder.feelsLikeUnits = (TextView) workingView
+                    .findViewById(R.id.weather_current_now_data_feelslike_units);
+
+            workingView.setTag(viewHolder);
+
+        } else {
+            viewHolder = (ViewThirdHolder) tag;
+        }
+
+        return viewHolder;
+    }
+
+
+    private static class ViewFirstHolder {
+        public ImageView picture;
+        public TextView tempMax;
+        public TextView tempMin;
+    }
+
+    private static class ViewSecondHolder {
+        public TextView weatherDescription;
+    }
+
+    private static class ViewThirdHolder {
+        public TextView humidityValue;
+        public TextView pressureValue;
+        public TextView windValue;
+        public TextView rainValue;
+        public TextView cloudsValue;
+        public TextView snowValue;
+        public TextView sunRiseTime;
+        public TextView sunSetTime;
+        public TextView feelsLike;
+        public TextView feelsLikeUnits;
+    }
+}
diff --git a/src/de/example/exampletdd/fragment/current/WeatherCurrentDataEntryFifth.java b/src/de/example/exampletdd/fragment/current/WeatherCurrentDataEntryFifth.java
new file mode 100644 (file)
index 0000000..2909624
--- /dev/null
@@ -0,0 +1,71 @@
+package de.example.exampletdd.fragment.current;
+
+public class WeatherCurrentDataEntryFifth {
+    private final String sunRiseTime;
+    private final String sunSetTime;
+    private final String humidityValue;
+    private final String pressureValue;
+    private final String windValue;
+    private final String rainValue;
+    private final String cloudsValue;
+    private final String feelsLike;
+    private final String feelsLikeUnits;
+    private final String snowValue;
+
+    public WeatherCurrentDataEntryFifth(final String sunRiseTime, final String sunSetTime,
+            final String humidityValue, final String pressureValue, final String windValue,
+            final String rainValue, final String feelsLike, final String feelsLikeUnits,
+            final String snowValue,
+            final String cloudsValue) {
+        this.sunRiseTime = sunRiseTime;
+        this.sunSetTime = sunSetTime;
+        this.humidityValue = humidityValue;
+        this.pressureValue = pressureValue;
+        this.windValue = windValue;
+        this.rainValue = rainValue;
+        this.feelsLike = feelsLike;
+        this.feelsLikeUnits = feelsLikeUnits;
+        this.snowValue = snowValue;
+        this.cloudsValue = cloudsValue;
+    }
+
+    public String getSunRiseTime() {
+        return this.sunRiseTime;
+    }
+
+    public String getSunSetTime() {
+        return this.sunSetTime;
+    }
+
+    public String getFeelsLike() {
+        return this.feelsLike;
+    }
+
+    public String getFeelsLikeUnits() {
+        return this.feelsLikeUnits;
+    }
+
+    public String getHumidityValue() {
+        return this.humidityValue;
+    }
+
+    public String getPressureValue() {
+        return this.pressureValue;
+    }
+
+    public String getWindValue() {
+        return this.windValue;
+    }
+
+    public String getRainValue() {
+        return this.rainValue;
+    }
+
+    public String getCloudsValue() {
+        return this.cloudsValue;
+    }
+
+    public String getSnowValue() {
+        return this.snowValue;
+    }
+}
diff --git a/src/de/example/exampletdd/fragment/current/WeatherCurrentDataEntryFirst.java b/src/de/example/exampletdd/fragment/current/WeatherCurrentDataEntryFirst.java
new file mode 100644 (file)
index 0000000..67d0463
--- /dev/null
@@ -0,0 +1,28 @@
+package de.example.exampletdd.fragment.current;
+
+import android.graphics.Bitmap;
+
+public class WeatherCurrentDataEntryFirst {
+    private final Bitmap picture;
+    private final String tempMax;
+    private final String tempMin;
+
+    public WeatherCurrentDataEntryFirst(final String tempMax, final String tempMin,
+            final Bitmap picture) {
+        this.tempMax = tempMax;
+        this.tempMin = tempMin;
+        this.picture = picture;
+    }
+
+    public Bitmap getPicture() {
+        return this.picture;
+    }
+
+    public String getTempMax() {
+        return this.tempMax;
+    }
+
+    public String getTempMin() {
+        return this.tempMin;
+    }
+}
diff --git a/src/de/example/exampletdd/fragment/current/WeatherCurrentDataEntrySecond.java b/src/de/example/exampletdd/fragment/current/WeatherCurrentDataEntrySecond.java
new file mode 100644 (file)
index 0000000..1d3222d
--- /dev/null
@@ -0,0 +1,14 @@
+package de.example.exampletdd.fragment.current;
+
+public class WeatherCurrentDataEntrySecond {
+    private final String weatherDescription;
+
+    public WeatherCurrentDataEntrySecond(final String weatherDescription) {
+        this.weatherDescription = weatherDescription;
+    }
+
+    public String getWeatherDescription() {
+        return this.weatherDescription;
+    }
+
+}
index 0fbe153..7c63d53 100644 (file)
@@ -8,10 +8,8 @@ import java.net.URL;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
-import java.util.List;
 import java.util.Locale;
 
 import org.apache.http.client.ClientProtocolException;
@@ -26,7 +24,6 @@ import android.os.AsyncTask;
 import android.os.Bundle;
 import android.preference.PreferenceManager;
 import android.util.Log;
-import android.widget.ImageView;
 import android.widget.ListView;
 
 import com.fasterxml.jackson.core.JsonParseException;
@@ -34,8 +31,7 @@ import com.fasterxml.jackson.core.JsonParseException;
 import de.example.exampletdd.R;
 import de.example.exampletdd.fragment.ErrorDialogFragment;
 import de.example.exampletdd.fragment.ProgressDialogFragment;
-import de.example.exampletdd.fragment.specific.WeatherSpecificDataAdapter;
-import de.example.exampletdd.fragment.specific.WeatherSpecificDataEntry;
+import de.example.exampletdd.fragment.overview.IconsList;
 import de.example.exampletdd.httpclient.CustomHTTPClient;
 import de.example.exampletdd.model.GeocodingData;
 import de.example.exampletdd.model.currentweather.CurrentWeatherData;
@@ -139,72 +135,111 @@ public class WeatherInformationCurrentDataFragment extends ListFragment {
                 Locale.getDefault());
 
         final double tempUnits = this.mIsFahrenheit ? 0 : 273.15;
+        final String symbol = this.mIsFahrenheit ? "ºF" : "ºC";
 
-        final List<WeatherSpecificDataEntry> entries = this.createEmptyEntriesList();
+        final int[] layouts = new int[3];
+        layouts[0] = R.layout.weather_current_data_entry_first;
+        layouts[1] = R.layout.weather_current_data_entry_second;
+        layouts[2] = R.layout.weather_current_data_entry_fifth;
+        final WeatherCurrentDataAdapter adapter = new WeatherCurrentDataAdapter(this.getActivity(),
+                layouts);
 
-        final WeatherSpecificDataAdapter adapter = new WeatherSpecificDataAdapter(
-                this.getActivity(), R.layout.weather_data_entry_list);
-
-        if (currentWeatherData.getWeather().size() > 0) {
-            entries.set(0,
-                    new WeatherSpecificDataEntry(this.getString(R.string.text_field_description),
-                            currentWeatherData.getWeather().get(0).getDescription()));
-        }
-
-        if (currentWeatherData.getMain().getTemp() != null) {
-            double conversion = (Double) currentWeatherData.getMain().getTemp();
-            conversion = conversion - tempUnits;
-            entries.set(1, new WeatherSpecificDataEntry(this.getString(R.string.text_field_tem),
-                    tempFormatter.format(conversion)));
-        }
 
+        String tempMax = "";
         if (currentWeatherData.getMain().getTemp_max() != null) {
             double conversion = (Double) currentWeatherData.getMain().getTemp_max();
             conversion = conversion - tempUnits;
-            entries.set(2, new WeatherSpecificDataEntry(
-                    this.getString(R.string.text_field_tem_max), tempFormatter.format(conversion)));
+            tempMax = tempFormatter.format(conversion) + symbol;
         }
-
-        if (currentWeatherData.getMain().getTemp_max() != null) {
+        String tempMin = "";
+        if (currentWeatherData.getMain().getTemp_min() != null) {
             double conversion = (Double) currentWeatherData.getMain().getTemp_min();
             conversion = conversion - tempUnits;
-            entries.set(3, new WeatherSpecificDataEntry(
-                    this.getString(R.string.text_field_tem_min), tempFormatter.format(conversion)));
+            tempMin = tempFormatter.format(conversion) + symbol;
+        }
+        Bitmap picture;
+        if ((currentWeatherData.getWeather().size() > 0)
+                && (currentWeatherData.getWeather().get(0).getIcon() != null)
+                && (IconsList.getIcon(currentWeatherData.getWeather().get(0).getIcon()) != null)) {
+            final String icon = currentWeatherData.getWeather().get(0).getIcon();
+            picture = BitmapFactory.decodeResource(this.getResources(), IconsList.getIcon(icon)
+                    .getResourceDrawable());
+        } else {
+            picture = BitmapFactory.decodeResource(this.getResources(),
+                    R.drawable.weather_severe_alert);
         }
+        final WeatherCurrentDataEntryFirst entryFirst = new WeatherCurrentDataEntryFirst(tempMax,
+                tempMin, picture);
+        adapter.add(entryFirst);
 
+        String description = "no description available";
+        if (currentWeatherData.getWeather().size() > 0) {
+            description = currentWeatherData.getWeather().get(0).getDescription();
+        }
+        final WeatherCurrentDataEntrySecond entrySecond = new WeatherCurrentDataEntrySecond(
+                description);
+        adapter.add(entrySecond);
+
+        String humidityValue = "";
+        if ((currentWeatherData.getMain() != null)
+                && (currentWeatherData.getMain().getHumidity() != null)) {
+            final double conversion = (Double) currentWeatherData.getMain().getHumidity();
+            humidityValue = tempFormatter.format(conversion);
+        }
+        String pressureValue = "";
+        if ((currentWeatherData.getMain() != null)
+                && (currentWeatherData.getMain().getPressure() != null)) {
+            final double conversion = (Double) currentWeatherData.getMain().getPressure();
+            pressureValue = tempFormatter.format(conversion);
+        }
+        String windValue = "";
+        if ((currentWeatherData.getWind() != null)
+                && (currentWeatherData.getWind().getSpeed() != null)) {
+            final double conversion = (Double) currentWeatherData.getWind().getSpeed();
+            windValue = tempFormatter.format(conversion);
+        }
+        String rainValue = "";
+        if ((currentWeatherData.getRain() != null)
+                && (currentWeatherData.getRain().get3h() != null)) {
+            final double conversion = (Double) currentWeatherData.getRain().get3h();
+            rainValue = tempFormatter.format(conversion);
+        }
+        String cloudsValue = "";
+        if ((currentWeatherData.getClouds() != null)
+                && (currentWeatherData.getClouds().getAll() != null)) {
+            final double conversion = (Double) currentWeatherData.getClouds().getAll();
+            cloudsValue = tempFormatter.format(conversion);
+        }
+        String snowValue = "";
+        if ((currentWeatherData.getSnow() != null)
+                && (currentWeatherData.getSnow().get3h() != null)) {
+            final double conversion = (Double) currentWeatherData.getSnow().get3h();
+            snowValue = tempFormatter.format(conversion);
+        }
+        String feelsLike = "";
+        if (currentWeatherData.getMain().getTemp() != null) {
+            double conversion = (Double) currentWeatherData.getMain().getTemp();
+            conversion = conversion - tempUnits;
+            feelsLike = tempFormatter.format(conversion);
+        }
+        String sunRiseTime = "";
         if (currentWeatherData.getSys().getSunrise() != null) {
             final long unixTime = (Long) currentWeatherData.getSys().getSunrise();
             final Date unixDate = new Date(unixTime * 1000L);
-            final String dateFormatUnix = dateFormat.format(unixDate);
-            entries.set(4,
-                    new WeatherSpecificDataEntry(this.getString(R.string.text_field_sun_rise),
-                            dateFormatUnix));
+            sunRiseTime = dateFormat.format(unixDate);
         }
-
+        String sunSetTime = "";
         if (currentWeatherData.getSys().getSunset() != null) {
             final long unixTime = (Long) currentWeatherData.getSys().getSunset();
             final Date unixDate = new Date(unixTime * 1000L);
-            final String dateFormatUnix = dateFormat.format(unixDate);
-            entries.set(5, new WeatherSpecificDataEntry(
-                    this.getString(R.string.text_field_sun_set), dateFormatUnix));
+            sunSetTime = dateFormat.format(unixDate);
         }
+        final WeatherCurrentDataEntryFifth entryFifth = new WeatherCurrentDataEntryFifth(
+                sunRiseTime, sunSetTime, humidityValue, pressureValue, windValue, rainValue,
+                feelsLike, symbol, snowValue, cloudsValue);
+        adapter.add(entryFifth);
 
-        if (currentWeatherData.getClouds().getAll() != null) {
-            final double cloudiness = (Double) currentWeatherData.getClouds().getAll();
-            entries.set(6,
-                    new WeatherSpecificDataEntry(this.getString(R.string.text_field_cloudiness),
-                            tempFormatter.format(cloudiness)));
-        }
 
-        if (currentWeatherData.getIconData() != null) {
-            final Bitmap icon = BitmapFactory.decodeByteArray(currentWeatherData.getIconData(), 0,
-                    currentWeatherData.getIconData().length);
-            final ImageView imageIcon = (ImageView) this.getActivity().findViewById(
-                    R.id.weather_picture);
-            imageIcon.setImageBitmap(icon);
-        }
-
-        adapter.addAll(entries);
         this.setListAdapter(adapter);
     }
 
@@ -343,26 +378,4 @@ public class WeatherInformationCurrentDataFragment extends ListFragment {
             weatherTask.execute(geocodingData);
         }
     }
-
-    private List<WeatherSpecificDataEntry> createEmptyEntriesList() {
-        final List<WeatherSpecificDataEntry> entries = new ArrayList<WeatherSpecificDataEntry>();
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_description),
-                null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_tem), null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_tem_max), null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_tem_min), null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_sun_rise), null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_sun_set), null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_cloudiness),
-                null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_rain_time),
-                null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_rain_amount),
-                null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_wind_speed),
-                null));
-        entries.add(new WeatherSpecificDataEntry(this.getString(R.string.text_field_humidity), null));
-
-        return entries;
-    }
 }
index 9d4a579..a9c2e77 100644 (file)
@@ -26,6 +26,7 @@ import android.graphics.BitmapFactory;
 import android.net.http.AndroidHttpClient;
 import android.os.AsyncTask;
 import android.os.Bundle;
+import android.os.Parcelable;
 import android.preference.PreferenceManager;
 import android.util.Log;
 import android.view.View;
@@ -50,6 +51,7 @@ public class WeatherInformationOverviewFragment extends ListFragment implements
     private boolean mIsFahrenheit;
     private String mDayForecast;
     private WeatherServicePersistenceFile mWeatherServicePersistenceFile;
+    private Parcelable mListState;
 
     @Override
     public void onCreate(final Bundle savedInstanceState) {
@@ -87,6 +89,8 @@ public class WeatherInformationOverviewFragment extends ListFragment implements
                     newFragment.show(this.getFragmentManager(), "errorDialog");
                 }
             }
+
+            this.mListState = savedInstanceState.getParcelable("ListState");
         }
 
         this.setHasOptionsMenu(false);
@@ -130,6 +134,9 @@ public class WeatherInformationOverviewFragment extends ListFragment implements
             savedInstanceState.putSerializable("ForecastWeatherData", forecastWeatherData);
         }
 
+        this.mListState = this.getListView().onSaveInstanceState();
+        savedInstanceState.putParcelable("ListState", this.mListState);
+
         super.onSaveInstanceState(savedInstanceState);
     }
 
@@ -250,7 +257,10 @@ public class WeatherInformationOverviewFragment extends ListFragment implements
         // 3. Update forecast weather data on display.
         final ForecastWeatherData forecastWeatherData = this.mWeatherServicePersistenceFile
                 .getForecastWeatherData();
-        if (forecastWeatherData != null) {
+        if ((this.mListState != null) && (forecastWeatherData != null)) {
+            this.updateForecastWeatherData(forecastWeatherData);
+            this.getListView().onRestoreInstanceState(this.mListState);
+        } else if (forecastWeatherData != null) {
             this.updateForecastWeatherData(forecastWeatherData);
         }
 
@@ -336,16 +346,6 @@ public class WeatherInformationOverviewFragment extends ListFragment implements
         private ForecastWeatherData doInBackgroundThrowable(final Object... params)
                 throws ClientProtocolException, MalformedURLException,
                 URISyntaxException, JsonParseException, IOException {
-            // final SharedPreferences sharedPreferences = PreferenceManager
-            // .getDefaultSharedPreferences(WeatherInformationOverviewFragment.this
-            // .getActivity());
-            //
-            // final String keyPreference =
-            // WeatherInformationOverviewFragment.this
-            // .getActivity().getString(
-            // R.string.weather_preferences_language_key);
-            // final String languagePreferenceValue =
-            // sharedPreferences.getString(keyPreference, "");
 
             // 1. Coordinates
             final GeocodingData geocodingData = (GeocodingData) params[0];
index 5e34202..3b1ed4b 100644 (file)
@@ -70,6 +70,8 @@ public class WeatherInformationSpecificDataFragment extends ListFragment impleme
                     newFragment.show(this.getFragmentManager(), "errorDialog");
                 }
             }
+
+            this.mChosenDay = savedInstanceState.getInt("Chosen day");
         }
     }
 
@@ -84,6 +86,8 @@ public class WeatherInformationSpecificDataFragment extends ListFragment impleme
             savedInstanceState.putSerializable("ForecastWeatherData", forecastWeatherData);
         }
 
+        savedInstanceState.putInt("Chosend day", this.mChosenDay);
+
         super.onSaveInstanceState(savedInstanceState);
     }