WeatherInformation Android
authorgu.martinm@gmail.com <gu.martinm@gmail.com>
Tue, 2 Sep 2014 16:04:44 +0000 (18:04 +0200)
committergu.martinm@gmail.com <gu.martinm@gmail.com>
Tue, 2 Sep 2014 16:04:44 +0000 (18:04 +0200)
specific fragment: without fragmentlist
android manifest: supported screens

15 files changed:
AndroidManifest.xml
res/layout/weather_specific.xml [new file with mode: 0644]
res/layout/weather_specific_data.xml [deleted file]
res/layout/weather_specific_fragment.xml [new file with mode: 0644]
res/values/strings.xml
src/de/example/exampletdd/SpecificActivity.java
src/de/example/exampletdd/WeatherInformationCurrentDataActivity.java [deleted file]
src/de/example/exampletdd/fragment/current/CurrentFragment.java
src/de/example/exampletdd/fragment/overview/OverviewFragment.java
src/de/example/exampletdd/fragment/specific/SpecificAdapter.java [deleted file]
src/de/example/exampletdd/fragment/specific/SpecificDataEntryFirst.java [deleted file]
src/de/example/exampletdd/fragment/specific/SpecificDataEntryFourth.java [deleted file]
src/de/example/exampletdd/fragment/specific/SpecificDataEntrySecond.java [deleted file]
src/de/example/exampletdd/fragment/specific/SpecificDataEntryThird.java [deleted file]
src/de/example/exampletdd/fragment/specific/SpecificFragment.java

index 856b325..7fe4e82 100644 (file)
     <uses-feature
         android:glEsVersion="0x00020000"
         android:required="true" />
+    
+    <!-- TODO: http://developer.android.com/guide/topics/manifest/supports-screens-element.html -->
+    <!-- TODO: supporting multiple layouts/languages http://developer.android.com/guide/practices/screens_support.html -->
+    <compatible-screens>
+       <screen android:screenSize="normal" android:screenDensity="xhdpi" />
+       </compatible-screens>
+    <supports-screens android:smallScreens="false" />
 
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -33,7 +40,8 @@
         android:label="@string/app_name"
         android:logo="@drawable/ic_launcher"
         android:theme="@style/AppTheme"
-        android:name="de.example.exampletdd.WeatherInformationApplication" >
+        android:name="de.example.exampletdd.WeatherInformationApplication"
+        android:supportsRtl="false">
         <!--
         <activity
             android:name="de.example.exampletdd.WeatherInformationActivity"
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-        <activity
-            android:name="de.example.exampletdd.WeatherInformationCurrentDataActivity"
-            android:parentActivityName="de.example.exampletdd.WeatherInformationActivity"
-            android:exported="false" >
-            <intent-filter>
-                <action android:name="android.intent.action.WEATHERINFORMATIONCURRENTDATA" />
-
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
         
         <receiver android:name=".WeatherInformationBootReceiver"
             android:enabled="false">
             android:name="com.google.android.gms.version"
             android:value="@integer/google_play_services_version" />
 
-        <activity
-            android:name="de.example.exampletdd.MasterDetailListActivity"
-            android:label="@string/title_masterdetail_list" >
-        </activity>
-        <activity
-            android:name="de.example.exampletdd.MasterDetailDetailActivity"
-            android:label="@string/title_masterdetail_detail"
-            android:parentActivityName="de.example.exampletdd.MasterDetailListActivity" >
-            <meta-data
-                android:name="android.support.PARENT_ACTIVITY"
-                android:value="de.example.exampletdd.MasterDetailListActivity" />
-        </activity>
     </application>
 
 </manifest>
diff --git a/res/layout/weather_specific.xml b/res/layout/weather_specific.xml
new file mode 100644 (file)
index 0000000..6147006
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:id="@+id/weather_specific"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:gravity="center"
+    android:orientation="vertical"
+    tools:context="de.example.exampletdd.SpecificActivity"
+    tools:ignore="MergeRootFrame" >
+
+
+     <fragment
+        android:id="@+id/specific_fragment"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        class="de.example.exampletdd.fragment.specific.SpecificFragment" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/weather_specific_data.xml b/res/layout/weather_specific_data.xml
deleted file mode 100644 (file)
index 0594573..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/weather_specific_data"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:gravity="center"
-    android:orientation="vertical"
-    tools:context="de.example.exampletdd.SpecificActivity"
-    tools:ignore="MergeRootFrame" >
-
-
-     <fragment
-        android:id="@+id/specific_fragment"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        class="de.example.exampletdd.fragment.specific.SpecificFragment" />
-
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/weather_specific_fragment.xml b/res/layout/weather_specific_fragment.xml
new file mode 100644 (file)
index 0000000..0768ae8
--- /dev/null
@@ -0,0 +1,451 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/weather_specific_fragment"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+       android:layout_height="wrap_content"
+       android:gravity="center"
+       android:layout_gravity="fill_vertical|center_horizontal"
+       android:orientation="vertical" >
+       
+        <!-- TODO: http://developer.android.com/guide/topics/manifest/supports-screens-element.html -->
+       <!-- TODO: supporting multiple layouts/languages http://developer.android.com/guide/practices/screens_support.html -->
+       <!-- TODO: Should I use RelativeLayout for long texts (I18N) and RTL/LTR UI?
+                With long texts, many times, text will not fit... The same for WP8 :/ -->
+       <LinearLayout
+               android:layout_width="match_parent"
+               android:layout_height="match_parent"
+               android:gravity="center"
+               android:layout_gravity="top|center"
+               android:padding="50dp"
+               android:orientation="horizontal" >
+
+               <ImageView
+                               android:id="@+id/weather_specific_picture"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:contentDescription="@string/icon_weather_description"
+                       android:scaleType="fitCenter"
+                       android:gravity="center"
+                       android:layout_gravity="center"
+                       android:src="@drawable/weather_showers" />
+
+               <LinearLayout
+                       android:layout_width="match_parent"
+                       android:layout_height="wrap_content"
+                       android:gravity="center"
+                       android:layout_gravity="center"
+                       android:orientation="vertical" >
+
+                       <TextView
+                           android:id="@+id/weather_specific_temp_max"
+                           android:layout_width="wrap_content"
+                           android:layout_height="wrap_content"
+                           android:paddingEnd="10dp"
+                           android:paddingStart="20dp"
+                           android:singleLine="true"
+                           android:text="55ºC"
+                           android:textAlignment="textStart"
+                           android:textAppearance="?android:attr/textAppearanceLarge"
+                           android:textStyle="bold" />
+
+                       <TextView
+                       android:id="@+id/weather_specific_temp_min"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:textAlignment="textStart"
+                       android:paddingEnd="10dp"
+                       android:paddingStart="20dp"
+                       android:singleLine="true"
+                       android:text="25ºC"
+                       android:textAppearance="?android:attr/textAppearanceMedium"
+                       android:textStyle="normal" />
+               </LinearLayout>
+               </LinearLayout>
+       
+       <LinearLayout
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:gravity="center"
+               android:padding="25dp"
+               android:layout_gravity="top|center"
+               android:orientation="horizontal" >
+
+               <TextView
+                       android:id="@+id/weather_specific_description"
+                       android:layout_width="match_parent"
+                       android:layout_height="wrap_content"
+                       android:gravity="center"
+                       android:text="Light rain"
+                       android:textAppearance="?android:attr/textAppearanceLarge"
+                       android:textColor="@color/weather_time_of_day_color_title"
+                       android:textStyle="bold" />    
+               </LinearLayout>
+
+        <LinearLayout
+               android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+               android:layout_gravity="top|center"
+               android:orientation="horizontal" >
+                               
+                       <!-- Humidity -->
+                       <TextView
+                       android:id="@+id/weather_specific_humidity"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:layout_gravity="start"
+                       android:layout_margin="5dp"
+                       android:gravity="start"
+                       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_specific_humidity_value"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="83"
+                       android:layout_gravity="start"
+                       android:gravity="start"
+                       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_specific_humidity_units"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="%"
+                       android:layout_gravity="end"
+                       android:gravity="end"
+                       android:textAlignment="textEnd"
+                       android:layout_marginTop="5dp"
+                       android:layout_marginBottom="5dp"
+                       android:layout_marginRight="5dp"
+                       android:textAppearance="?android:attr/textAppearanceSmall"
+                       android:textStyle="bold" />
+
+                <!-- Rain -->
+                       <TextView
+                       android:id="@+id/weather_specific_rain"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                               android:text="RAIN"
+                       android:layout_gravity="end"
+                       android:gravity="end"
+                       android:textAlignment="textEnd"
+                       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_specific_rain_value"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="1.24"
+                       android:layout_gravity="end"
+                       android:gravity="end"
+                       android:textAlignment="textEnd"
+                       android:layout_marginTop="5dp"
+                       android:layout_marginBottom="5dp"
+                       android:textAppearance="?android:attr/textAppearanceSmall"
+                       android:textStyle="normal" />
+        
+                       <!-- Rain Units -->
+                       <TextView
+                       android:id="@+id/weather_specific_rain_units"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text=" mm 3h"
+                       android:layout_gravity="end"
+                       android:gravity="end"
+                       android:textAlignment="textEnd"
+                       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="top|center"
+               android:orientation="horizontal" >
+                       
+                       <!-- Wind -->
+                       <TextView
+                       android:id="@+id/weather_specific_wind"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="WIND"
+                       android:layout_gravity="start"
+                       android:gravity="start"
+                       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_specific_wind_value"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                               android:text="6.36"
+                       android:layout_gravity="start"
+                       android:gravity="start"
+                       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_specific_wind_units"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text=" m/s"
+                       android:layout_gravity="start"
+                       android:gravity="start"
+                       android:textAlignment="textStart"
+                       android:layout_marginTop="5dp"
+                       android:layout_marginBottom="5dp"
+                       android:layout_marginRight="5dp"
+                       android:textAppearance="?android:attr/textAppearanceSmall"
+                       android:textStyle="bold" />
+                       
+                <!-- Clouds -->
+                       <TextView
+                       android:id="@+id/weather_specific_clouds"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="CLOUDS"
+                       android:layout_gravity="end"
+                       android:gravity="end"
+                       android:textAlignment="textEnd"
+                       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_specific_clouds_value"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="6.36"
+                       android:layout_gravity="end"
+                       android:layout_marginTop="5dp"
+                       android:layout_marginBottom="5dp"
+                       android:gravity="end"
+                       android:textAlignment="textEnd"
+                       android:textAppearance="?android:attr/textAppearanceSmall"
+                       android:textStyle="normal" />
+        
+                       <!-- Clouds Units -->
+                       <TextView
+                       android:id="@+id/weather_specific_clouds_units"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="%"
+                       android:layout_gravity="end"
+                       android:gravity="end"
+                       android:textAlignment="textEnd"
+                       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="top|center"
+               android:orientation="horizontal" >
+        
+                       <!-- Pressure -->
+                       <TextView
+                       android:id="@+id/weather_specific_pressure"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="PRESSURE"
+                       android:layout_gravity="start"
+                       android:gravity="start"
+                       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_specific_pressure_value"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text="1036.05"
+                       android:layout_gravity="start"
+                       android:gravity="start"
+                       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_specific_pressure_units"
+                       android:layout_width="wrap_content"
+                       android:layout_height="wrap_content"
+                       android:text=" hpa"
+                               android:layout_gravity="start"
+                       android:gravity="start"
+                       android:textAlignment="textStart"
+                       android:layout_marginTop="5dp"
+                       android:layout_marginBottom="5dp"
+                       android:layout_marginRight="5dp"
+                       android:textAppearance="?android:attr/textAppearanceSmall"
+                       android:textStyle="bold" />
+        </LinearLayout>
+        
+        <HorizontalScrollView
+               android:layout_width="match_parent"
+               android:layout_height="wrap_content"
+               android:layout_gravity="bottom|start"
+               android:paddingTop="50dp" >
+                       
+               <LinearLayout
+                               android:layout_width="wrap_content"
+                               android:layout_height="wrap_content"
+                               android:orientation="horizontal" >
+                               <LinearLayout
+                                       android:layout_width="wrap_content"
+                                       android:layout_height="wrap_content"
+                                       android:paddingStart="20dp"
+                                       android:paddingEnd="20dp"
+                                       android:orientation="vertical" >
+                       
+                                       <!-- Time of day -->
+                                       <TextView
+                                       android:id="@+id/weather_specific_morn"
+                                               android:layout_width="wrap_content"
+                                               android:layout_height="wrap_content"
+                                       android:text="MORNING"
+                                       android:textColor="@color/weather_time_of_day_color_title"
+                                       android:textAlignment="center"
+                                       android:layout_gravity="top|center"
+                                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                               
+                                       <!-- Temperature -->
+                                       <TextView
+                                               android:id="@+id/weather_specific_morn_temperature"
+                                               android:layout_width="wrap_content"
+                                               android:layout_height="wrap_content"
+                                       android:text="55ºC"
+                                       android:textAlignment="center"
+                                       android:layout_gravity="bottom|center"
+                                       android:textAppearance="?android:attr/textAppearanceMedium"
+                                       android:textStyle="bold" />
+                               </LinearLayout>
+                               <LinearLayout
+                                       android:layout_width="wrap_content"
+                                       android:layout_height="wrap_content"
+                                       android:orientation="vertical" >
+                               
+                                       <!-- Time of day -->
+                                       <TextView
+                                       android:id="@+id/weather_specific_day"
+                                               android:layout_width="wrap_content"
+                                               android:layout_height="wrap_content"
+                                       android:text="DAY"
+                                       android:textColor="@color/weather_time_of_day_color_title"
+                                       android:textAlignment="center"
+                                       android:layout_gravity="top|center"
+                                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                               
+                                       <!-- Temperature -->
+                                       <TextView
+                                               android:id="@+id/weather_specific_day_temperature"
+                                               android:layout_width="wrap_content"
+                                               android:layout_height="wrap_content"
+                                       android:text="55ºC"
+                                       android:textAlignment="center"
+                                       android:layout_gravity="bottom|center"
+                                       android:textAppearance="?android:attr/textAppearanceMedium"
+                                       android:textStyle="bold" />
+                               </LinearLayout>
+                               <LinearLayout
+                                       android:layout_width="wrap_content"
+                                       android:layout_height="wrap_content"
+                                       android:paddingStart="20dp"
+                                       android:paddingEnd="20dp"
+                                       android:orientation="vertical" >
+                       
+                                       <!-- Time of day -->
+                                       <TextView
+                                       android:id="@+id/weather_specific_eve"
+                                               android:layout_width="wrap_content"
+                                               android:layout_height="wrap_content"
+                                       android:text="EVENING"
+                                       android:textColor="@color/weather_time_of_day_color_title"
+                                       android:textAlignment="center"
+                                       android:layout_gravity="top|center"
+                                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                               
+                                       <!-- Temperature -->
+                                       <TextView
+                                               android:id="@+id/weather_specific_eve_temperature"
+                                               android:layout_width="wrap_content"
+                                               android:layout_height="wrap_content"
+                                       android:text="55ºC"
+                                       android:textAlignment="center"
+                                       android:layout_gravity="bottom|center"
+                                       android:textAppearance="?android:attr/textAppearanceMedium"
+                                       android:textStyle="bold" />
+                               </LinearLayout>
+                                                       <LinearLayout
+                                       android:layout_width="wrap_content"
+                                       android:layout_height="wrap_content"
+                                       android:paddingStart="20dp"
+                                       android:paddingEnd="20dp"
+                                       android:orientation="vertical" >
+                       
+                                       <!-- Time of day -->
+                                       <TextView
+                                       android:id="@+id/weather_specific_night"
+                                               android:layout_width="wrap_content"
+                                               android:layout_height="wrap_content"
+                                       android:text="NIGHT"
+                                       android:textColor="@color/weather_time_of_day_color_title"
+                                       android:textAlignment="center"
+                                       android:layout_gravity="top|center"
+                                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                               
+                                       <!-- Temperature -->
+                                       <TextView
+                                               android:id="@+id/weather_specific_night_temperature"
+                                               android:layout_width="wrap_content"
+                                               android:layout_height="wrap_content"
+                                       android:text="55ºC"
+                                       android:textAlignment="center"
+                                       android:layout_gravity="bottom|center"
+                                       android:textAppearance="?android:attr/textAppearanceMedium"
+                                       android:textStyle="bold" />
+                               </LinearLayout>
+                       </LinearLayout>
+               </HorizontalScrollView>
+       </LinearLayout>
+</ScrollView>
index 46edf0e..624d86d 100644 (file)
@@ -50,7 +50,5 @@
     <string name="title_section1">Section 1</string>
     <string name="title_section2">Section 2</string>
     <string name="title_section3">Section 3</string>
-    <string name="title_masterdetail_list">MasterDetails</string>
-    <string name="title_masterdetail_detail">MasterDetail Detail</string>
 
 </resources>
index d0e131a..0079600 100644 (file)
@@ -10,7 +10,7 @@ public class SpecificActivity extends FragmentActivity {
     @Override
     protected void onCreate(final Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        this.setContentView(R.layout.weather_specific_data);
+        this.setContentView(R.layout.weather_specific);
 
         final ActionBar actionBar = this.getActionBar();
 
diff --git a/src/de/example/exampletdd/WeatherInformationCurrentDataActivity.java b/src/de/example/exampletdd/WeatherInformationCurrentDataActivity.java
deleted file mode 100644 (file)
index 21277cc..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package de.example.exampletdd;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.os.Bundle;
-import de.example.exampletdd.model.GeocodingData;
-import de.example.exampletdd.service.ServicePersistenceStorage;
-
-public class WeatherInformationCurrentDataActivity extends Activity {
-
-    @Override
-    protected void onCreate(final Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        this.setContentView(R.layout.weather_current_data);
-
-        final ActionBar actionBar = this.getActionBar();
-
-        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
-        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
-        actionBar.setDisplayHomeAsUpEnabled(true);
-
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-
-        final ActionBar actionBar = this.getActionBar();
-
-        actionBar.setTitle("Current weather information");
-
-        final ServicePersistenceStorage weatherServicePersistenceFile = new ServicePersistenceStorage(this);
-        final GeocodingData geocodingData = weatherServicePersistenceFile.getGeocodingData();
-
-        if (geocodingData != null) {
-            final String city = (geocodingData.getCity() == null) ? this
-                    .getString(R.string.city_not_found) : geocodingData.getCity();
-                    final String country = (geocodingData.getCountry() == null) ? this
-                            .getString(R.string.country_not_found) : geocodingData.getCountry();
-                            actionBar.setTitle(city + "," + country);
-                            actionBar.setSubtitle("CURRENTLY");
-        }
-
-    }
-}
index 8f3bd53..c0d4c03 100644 (file)
@@ -321,6 +321,7 @@ public class CurrentFragment extends ListFragment {
                 
                if (current == null) {
                        // Nothing to do
+                       // TODO: Should I show some error message? I am not doing it on WP8 Should I do it on WP8?
                        return;
                }
 
index d2cfbc1..0de0cf5 100644 (file)
@@ -309,6 +309,7 @@ public class OverviewFragment extends ListFragment {
  
                if (forecast == null) {
                        // Nothing to do
+                       // TODO: Should I show some error message? I am not doing it on WP8 Should I do it on WP8?
                        return;
                }
 
diff --git a/src/de/example/exampletdd/fragment/specific/SpecificAdapter.java b/src/de/example/exampletdd/fragment/specific/SpecificAdapter.java
deleted file mode 100644 (file)
index 9a8dabf..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-package de.example.exampletdd.fragment.specific;
-
-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 SpecificAdapter extends ArrayAdapter<Object> {
-    private static final int FIRST = 0;
-    private static final int SECOND = 1;
-    private static final int THIRD = 2;
-    private static final int FOURTH = 3;
-    private final int[] resources;
-
-    public SpecificAdapter(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 SpecificDataEntryFirst entry = (SpecificDataEntryFirst) 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 SpecificDataEntrySecond entry = (SpecificDataEntrySecond) this
-                    .getItem(position);
-            viewHolder.weatherDescription.setText(entry.getWeatherDescription());
-        } else if (viewType == THIRD) {
-            final ViewThirdHolder viewHolder = this.getViewThirdHolder(view);
-            final SpecificDataEntryThird entry = (SpecificDataEntryThird) 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());
-        } else if (viewType == FOURTH) {
-            final ViewFourthHolder viewHolder = this.getViewFourthHolder(view);
-            final SpecificDataEntryFourth entry = (SpecificDataEntryFourth) this
-                    .getItem(position);
-            viewHolder.dayTemp.setText(entry.getDayTemp());
-            viewHolder.morningTemp.setText(entry.getEveTemp());
-            viewHolder.eveTemp.setText(entry.getEveTemp());
-            viewHolder.nightTemp.setText(entry.getNightTemp());
-        }
-
-        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;
-        } else if (position == 3) {
-            type = FOURTH;
-        }
-
-        return type;
-    }
-
-    @Override
-    public int getViewTypeCount() {
-        return 4;
-    }
-
-    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_data_humidity_value);
-            viewHolder.pressureValue = (TextView) workingView
-                    .findViewById(R.id.weather_current_data_pressure_value);
-            viewHolder.rainValue = (TextView) workingView
-                    .findViewById(R.id.weather_current_data_rain_value);
-            viewHolder.cloudsValue = (TextView) workingView
-                    .findViewById(R.id.weather_current_data_clouds_value);
-            viewHolder.windValue = (TextView) workingView
-                    .findViewById(R.id.weather_current_data_wind_value);
-
-            workingView.setTag(viewHolder);
-
-        } else {
-            viewHolder = (ViewThirdHolder) tag;
-        }
-
-        return viewHolder;
-    }
-
-    private ViewFourthHolder getViewFourthHolder(final View workingView) {
-        final Object tag = workingView.getTag();
-        ViewFourthHolder viewHolder = null;
-
-        if ((null == tag) || !(tag instanceof ViewFourthHolder)) {
-            viewHolder = new ViewFourthHolder();
-
-            viewHolder.morningTemp = (TextView) workingView
-                    .findViewById(R.id.weather_morn_temperature);
-            viewHolder.dayTemp = (TextView) workingView.findViewById(R.id.weather_day_temperature);
-            viewHolder.eveTemp = (TextView) workingView.findViewById(R.id.weather_eve_temperature);
-            viewHolder.nightTemp = (TextView) workingView
-                    .findViewById(R.id.weather_night_temperature);
-
-            workingView.setTag(viewHolder);
-
-        } else {
-            viewHolder = (ViewFourthHolder) 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;
-    }
-
-    private static class ViewFourthHolder {
-        private TextView morningTemp;
-        private TextView dayTemp;
-        private TextView eveTemp;
-        private TextView nightTemp;
-    }
-}
diff --git a/src/de/example/exampletdd/fragment/specific/SpecificDataEntryFirst.java b/src/de/example/exampletdd/fragment/specific/SpecificDataEntryFirst.java
deleted file mode 100644 (file)
index ccd50dc..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package de.example.exampletdd.fragment.specific;
-
-import android.graphics.Bitmap;
-
-public class SpecificDataEntryFirst {
-    private final Bitmap picture;
-    private final String tempMax;
-    private final String tempMin;
-
-    public SpecificDataEntryFirst(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/specific/SpecificDataEntryFourth.java b/src/de/example/exampletdd/fragment/specific/SpecificDataEntryFourth.java
deleted file mode 100644 (file)
index c0c33ce..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-package de.example.exampletdd.fragment.specific;
-
-public class SpecificDataEntryFourth {
-    private final String morningTemp;
-    private final String dayTemp;
-    private final String eveTemp;
-    private final String nightTemp;
-
-    public SpecificDataEntryFourth(final String morningTemp, final String dayTemp,
-            final String eveTemp, final String nightTemp) {
-        this.morningTemp = morningTemp;
-        this.dayTemp = dayTemp;
-        this.eveTemp = eveTemp;
-        this.nightTemp = nightTemp;
-    }
-
-    public String getMorningTemp() {
-        return this.morningTemp;
-    }
-
-    public String getDayTemp() {
-        return this.dayTemp;
-    }
-
-    public String getEveTemp() {
-        return this.eveTemp;
-    }
-
-    public String getNightTemp() {
-        return this.nightTemp;
-    }
-
-}
diff --git a/src/de/example/exampletdd/fragment/specific/SpecificDataEntrySecond.java b/src/de/example/exampletdd/fragment/specific/SpecificDataEntrySecond.java
deleted file mode 100644 (file)
index 6471b17..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package de.example.exampletdd.fragment.specific;
-
-public class SpecificDataEntrySecond {
-    private final String weatherDescription;
-
-    public SpecificDataEntrySecond(final String weatherDescription) {
-        this.weatherDescription = weatherDescription;
-    }
-
-    public String getWeatherDescription() {
-        return this.weatherDescription;
-    }
-
-}
diff --git a/src/de/example/exampletdd/fragment/specific/SpecificDataEntryThird.java b/src/de/example/exampletdd/fragment/specific/SpecificDataEntryThird.java
deleted file mode 100644 (file)
index d33ed13..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package de.example.exampletdd.fragment.specific;
-
-public class SpecificDataEntryThird {
-    private final String humidityValue;
-    private final String pressureValue;
-    private final String windValue;
-    private final String rainValue;
-    private final String cloudsValue;
-
-    public SpecificDataEntryThird(final String humidityValue, final String pressureValue,
-            final String windValue, final String rainValue, final String cloudsValue) {
-        this.humidityValue = humidityValue;
-        this.pressureValue = pressureValue;
-        this.windValue = windValue;
-        this.rainValue = rainValue;
-        this.cloudsValue = cloudsValue;
-    }
-
-    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;
-    }
-
-}
index 7339dd4..e0d67fd 100644 (file)
@@ -13,20 +13,32 @@ import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.os.Bundle;
 import android.preference.PreferenceManager;
-import android.support.v4.app.ListFragment;
-import android.widget.ListView;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
 import de.example.exampletdd.R;
 import de.example.exampletdd.WeatherInformationApplication;
 import de.example.exampletdd.model.forecastweather.Forecast;
 import de.example.exampletdd.service.IconsList;
 
-public class SpecificFragment extends ListFragment {
+public class SpecificFragment extends Fragment {
     private int mChosenDay;
 
     @Override
     public void onCreate(final Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
     }
+    
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                             Bundle savedInstanceState) {
+    
+       // Inflate the layout for this fragment
+        return inflater.inflate(R.layout.weather_specific_fragment, container, false);
+    }
 
     @Override
     public void onConfigurationChanged(final Configuration newConfig) {
@@ -41,7 +53,7 @@ public class SpecificFragment extends ListFragment {
             this.mChosenDay = extras.getInt("CHOSEN_DAY", 0);
         } else {
                // tablet layout
-               // Always 0 when tablet layout.
+               // Always 0 when tablet layout (by default shows the first day)
             this.mChosenDay = 0;
         }
     }
@@ -50,9 +62,6 @@ public class SpecificFragment extends ListFragment {
     public void onActivityCreated(final Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
 
-        final ListView listWeatherView = this.getListView();
-        listWeatherView.setChoiceMode(ListView.CHOICE_MODE_NONE);     
-
         if (savedInstanceState != null) {
                // Restore UI state
             final Forecast forecast = (Forecast) savedInstanceState.getSerializable("Forecast");
@@ -68,13 +77,6 @@ public class SpecificFragment extends ListFragment {
             this.mChosenDay = savedInstanceState.getInt("Chosen day");
             // TODO: Why don't I need mListState?
         }
-        
-        // TODO: Why don't I need Adapter?
-        
-        // TODO: string static resource
-        this.setEmptyText("No data available");
-        // TODO: Why is it different to Current and Overview fragments?
-        this.setListShownNoAnimation(false);
     }
 
     @Override
@@ -142,14 +144,6 @@ public class SpecificFragment extends ListFragment {
         
 
         // 3. Prepare data for UI.
-        final int[] layouts = new int[4];
-        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_third;
-        layouts[3] = R.layout.weather_current_data_entry_fourth;
-        final SpecificAdapter adapter = new SpecificAdapter(this.getActivity(), layouts);
-
-
         final de.example.exampletdd.model.forecastweather.List forecast = forecastWeatherData
                 .getList().get((chosenDay));
 
@@ -157,16 +151,14 @@ public class SpecificFragment extends ListFragment {
         final Calendar calendar = Calendar.getInstance();
         final Long forecastUNIXDate = (Long) forecast.getDt();
         calendar.setTimeInMillis(forecastUNIXDate * 1000L);
-        final Date date = calendar.getTime();
-        this.getActivity().getActionBar().setSubtitle(dayFormatter.format(date).toUpperCase());
-
+        final Date date = calendar.getTime();     
 
         String tempMax = "";
         if (forecast.getTemp().getMax() != null) {
             double conversion = (Double) forecast.getTemp().getMax();
             conversion = conversion - tempUnits;
             tempMax = tempFormatter.format(conversion) + symbol;
-        }
+        }        
         String tempMin = "";
         if (forecast.getTemp().getMin() != null) {
             double conversion = (Double) forecast.getTemp().getMin();
@@ -182,25 +174,22 @@ public class SpecificFragment extends ListFragment {
         } else {
             picture = BitmapFactory.decodeResource(this.getResources(),
                     R.drawable.weather_severe_alert);
-        }
-        final SpecificDataEntryFirst entryFirst = new SpecificDataEntryFirst(tempMax,
-                tempMin, picture);
-        adapter.add(entryFirst);
+        }       
 
+        // TODO: string resource
         String description = "no description available";
         if (forecast.getWeather().size() > 0) {
             description = forecast.getWeather().get(0).getDescription();
         }
-        final SpecificDataEntrySecond entrySecond = new SpecificDataEntrySecond(
-                description);
-        adapter.add(entrySecond);
-
+        final TextView descriptionView = (TextView) getActivity().findViewById(R.id.weather_specific_description);
+        descriptionView.setText(description);
 
+        // TODO: units!!!!
         String humidityValue = "";
         if (forecast.getHumidity() != null) {
             final double conversion = (Double) forecast.getHumidity();
             humidityValue = tempFormatter.format(conversion);
-        }
+        }        
         String pressureValue = "";
         if (forecast.getPressure() != null) {
             final double conversion = (Double) forecast.getPressure();
@@ -221,9 +210,6 @@ public class SpecificFragment extends ListFragment {
             final double conversion = (Double) forecast.getClouds();
             cloudsValue = tempFormatter.format(conversion);
         }
-        final SpecificDataEntryThird entryThird = new SpecificDataEntryThird(
-                humidityValue, pressureValue, windValue, rainValue, cloudsValue);
-        adapter.add(entryThird);
 
         String tempDay = "";
         if (forecast.getTemp().getDay() != null) {
@@ -242,21 +228,44 @@ public class SpecificFragment extends ListFragment {
             double conversion = (Double) forecast.getTemp().getEve();
             conversion = conversion - tempUnits;
             tempEve = tempFormatter.format(conversion) + symbol;
-        }
+        }   
         String tempNight = "";
         if (forecast.getTemp().getNight() != null) {
             double conversion = (Double) forecast.getTemp().getNight();
             conversion = conversion - tempUnits;
             tempNight = tempFormatter.format(conversion) + symbol;
-        }
-        final SpecificDataEntryFourth entryFourth = new SpecificDataEntryFourth(
-                tempMorn, tempDay, tempEve, tempNight);
-        adapter.add(entryFourth);
+        }   
 
 
         // 4. Update UI.
-        // TODO: Why am I not doing the same as in OverviewFragment?
-        this.setListAdapter(adapter);
+        this.getActivity().getActionBar().setSubtitle(dayFormatter.format(date).toUpperCase());
+        
+        final TextView tempMaxView = (TextView) getActivity().findViewById(R.id.weather_specific_temp_max);
+        tempMaxView.setText(tempMax);
+        final TextView tempMinView = (TextView) getActivity().findViewById(R.id.weather_specific_temp_min);
+        tempMinView.setText(tempMin);
+        final ImageView pictureView = (ImageView) getActivity().findViewById(R.id.weather_specific_picture);
+        pictureView.setImageBitmap(picture);    
+        
+        final TextView humidityValueView = (TextView) getActivity().findViewById(R.id.weather_specific_humidity_value);
+        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);
+        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);
+        cloudsValueView.setText(cloudsValue); 
+        
+        final TextView tempDayView = (TextView) getActivity().findViewById(R.id.weather_specific_day_temperature);
+        tempDayView.setText(tempDay);
+        final TextView tempMornView = (TextView) getActivity().findViewById(R.id.weather_specific_morn_temperature);
+        tempMornView.setText(tempMorn);
+        final TextView tempEveView = (TextView) getActivity().findViewById(R.id.weather_specific_eve_temperature);
+        tempEveView.setText(tempEve);
+        final TextView tempNightView = (TextView) getActivity().findViewById(R.id.weather_specific_night_temperature);
+        tempNightView.setText(tempNight);
     }
 
     @Override