No time for comments
authorgu.martinm@gmail.com <gu.martinm@gmail.com>
Mon, 31 Mar 2014 00:02:18 +0000 (02:02 +0200)
committergu.martinm@gmail.com <gu.martinm@gmail.com>
Mon, 31 Mar 2014 00:02:18 +0000 (02:02 +0200)
AndroidManifest.xml
res/layout/activity_main.xml
res/layout/fragment_main.xml
src/de/example/exampletdd/WeatherInformationActivity.java

index ba00203..c568896 100644 (file)
@@ -1,19 +1,22 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="de.example.exampletdd"
+    android:installLocation="auto"
     android:versionCode="1"
-    android:versionName="1.0" android:installLocation="auto">
+    android:versionName="1.0" >
 
     <uses-sdk
+        android:maxSdkVersion="18"
         android:minSdkVersion="18"
-        android:targetSdkVersion="18" android:maxSdkVersion="18"/>
-    <uses-permission android:name="android.permission.INTERNET"/>
+        android:targetSdkVersion="18" />
+
+    <uses-permission android:name="android.permission.INTERNET" />
 
     <application
         android:allowBackup="true"
         android:icon="@drawable/ic_launcher"
         android:label="@string/app_name"
-        android:theme="@style/AppTheme" >
+        android:theme="@android:style/Theme.Holo" >
         <activity
             android:name="de.example.exampletdd.WeatherInformationActivity"
             android:label="@string/app_name" >
index 7b7418a..f6e05a5 100644 (file)
@@ -3,5 +3,14 @@
     android:id="@+id/container"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    tools:context="de.example.exampletdd.MainActivity"
-    tools:ignore="MergeRootFrame" />
+    tools:context="de.example.exampletdd.WeatherInformationActivity"
+    tools:ignore="MergeRootFrame" >
+
+    <fragment
+        android:id="@+id/weather_data_frag"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        class="de.example.exampletdd.fragment.WeatherDataFragment"
+        tools:layout="@layout/fragment_main" />
+
+</FrameLayout>
index 29dd98f..879d382 100644 (file)
     android:paddingLeft="@dimen/activity_horizontal_margin"
     android:paddingRight="@dimen/activity_horizontal_margin"
     android:paddingTop="@dimen/activity_vertical_margin"
-    tools:context="de.example.exampletdd.MainActivity$PlaceholderFragment" >
+    tools:context="de.example.exampletdd.fragment.WeatherDataFragment" >
 
     <EditText
         android:id="@+id/editTextCity"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:background="@android:color/transparent"
         android:ems="10"
         android:inputType="text"
         android:labelFor="@id/editTextCity"
-        android:text="@string/text_default_city" />
-
-    <Button
-        android:id="@+id/buttonweather"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_centerHorizontal="true"
-        android:layout_marginBottom="24dp"
-        android:onClick="onClickGetWeather"
-        android:text="@string/button_weather" />
+        android:text="@string/text_default_city"
+        android:textStyle="bold" />
 
     <EditText
         android:id="@+id/editTextWeatherDescription"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_below="@+id/editTextCity"
         android:layout_centerHorizontal="true"
         android:layout_marginTop="102dp"
+        android:background="@android:color/transparent"
         android:ems="10"
+        android:enabled="false"
         android:inputType="none"
         android:labelFor="@id/editTextWeatherDescription"
-        android:text="@string/text_field_description" />
+        android:text="@string/text_field_description"
+        android:textStyle="bold" />
+
+    <ImageView
+        android:id="@+id/imageIcon"
+        android:layout_width="100dp"
+        android:layout_height="100dp"
+        android:layout_below="@+id/editTextCity"
+        android:layout_centerHorizontal="true"
+        android:contentDescription="@string/icon_weather_description"
+        android:scaleType="fitCenter"
+        android:src="@drawable/ic_launcher" />
 
     <EditText
-        android:id="@+id/editTextTemperature"
-        android:layout_width="wrap_content"
+        android:id="@+id/editTextSunSet"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_below="@+id/editTextWeatherDescription"
-        android:layout_centerHorizontal="true"
+        android:layout_above="@+id/buttonweather"
+        android:layout_alignLeft="@+id/editTextSunRise"
+        android:layout_marginBottom="18dp"
+        android:background="@android:color/transparent"
         android:ems="10"
+        android:enabled="false"
         android:inputType="none"
-        android:labelFor="@id/editTextTemperature"
-        android:text="@string/text_field_tem" />
+        android:labelFor="@id/editTextSunSet"
+        android:text="@string/text_field_sun_set"
+        android:textStyle="bold" />
 
     <EditText
-        android:id="@+id/editTextMaxTemperature"
-        android:layout_width="wrap_content"
+        android:id="@+id/editTextSunRise"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_below="@+id/editTextTemperature"
-        android:layout_centerHorizontal="true"
+        android:layout_above="@+id/editTextSunSet"
+        android:layout_alignLeft="@+id/editTextMinTemperature"
+        android:layout_marginBottom="18dp"
+        android:background="@android:color/transparent"
         android:ems="10"
+        android:enabled="false"
         android:inputType="none"
-        android:labelFor="@id/editTextMaxTemperature"
-        android:text="@string/text_field_tem_max" />
+        android:labelFor="@id/editTextSunRise"
+        android:text="@string/text_field_sun_rise"
+        android:textStyle="bold" />
 
     <EditText
         android:id="@+id/editTextMinTemperature"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_below="@+id/editTextMaxTemperature"
-        android:layout_centerHorizontal="true"
+        android:layout_above="@+id/editTextSunRise"
+        android:layout_alignLeft="@+id/editTextMaxTemperature"
+        android:layout_marginBottom="18dp"
+        android:background="@android:color/transparent"
         android:ems="10"
+        android:enabled="false"
         android:inputType="none"
         android:labelFor="@id/editTextMinTemperature"
-        android:text="@string/text_field_tem_min" />
+        android:text="@string/text_field_tem_min"
+        android:textStyle="bold" />
 
     <EditText
-        android:id="@+id/editTextSunRise"
-        android:layout_width="wrap_content"
+        android:id="@+id/editTextMaxTemperature"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_below="@+id/editTextMinTemperature"
-        android:layout_centerHorizontal="true"
+        android:layout_alignLeft="@+id/editTextTemperature"
+        android:layout_centerVertical="true"
+        android:background="@android:color/transparent"
         android:ems="10"
+        android:enabled="false"
         android:inputType="none"
-        android:labelFor="@id/editTextSunRise"
-        android:text="@string/text_field_sun_rise" />
+        android:labelFor="@id/editTextMaxTemperature"
+        android:text="@string/text_field_tem_max"
+        android:textStyle="bold" />
 
     <EditText
-        android:id="@+id/editTextSunSet"
-        android:layout_width="wrap_content"
+        android:id="@+id/editTextTemperature"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_below="@+id/editTextSunRise"
-        android:layout_centerHorizontal="true"
+        android:layout_alignLeft="@+id/editTextWeatherDescription"
+        android:layout_below="@+id/editTextWeatherDescription"
+        android:layout_marginTop="19dp"
+        android:background="@android:color/transparent"
         android:ems="10"
+        android:enabled="false"
         android:inputType="none"
-        android:labelFor="@id/editTextSunSet"
-        android:text="@string/text_field_sun_set" />
+        android:labelFor="@id/editTextTemperature"
+        android:text="@string/text_field_tem"
+        android:textStyle="bold" />
 
-    <ImageView
-        android:id="@+id/imageIcon"
-        android:layout_width="100dp"
-        android:layout_height="100dp"
-        android:layout_below="@+id/editTextCity"
+    <Button
+        android:id="@+id/buttonweather"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
         android:layout_centerHorizontal="true"
-        android:contentDescription="@string/icon_weather_description"
-        android:scaleType="fitCenter"
-        android:src="@drawable/ic_launcher" />
+        android:layout_marginBottom="19dp"
+        android:onClick="onClickGetWeather"
+        android:text="@string/button_weather" />
 
 </RelativeLayout>
\ No newline at end of file
index c721b7d..f785e3f 100644 (file)
@@ -19,12 +19,15 @@ public class WeatherInformationActivity extends Activity implements ErrorMessage
         super.onCreate(savedInstanceState);
         this.setContentView(R.layout.activity_main);
 
-        final WeatherDataFragment weatherDataFragment = new WeatherDataFragment();
-
-        if (savedInstanceState == null) {
-            this.getFragmentManager().beginTransaction()
-            .add(R.id.container, weatherDataFragment).commit();
-        }
+        // Better using xml files.
+        // final WeatherDataFragment weatherDataFragment = new WeatherDataFragment();
+        //
+        // if (savedInstanceState == null) {
+        //      this.getFragmentManager().beginTransaction()
+        //      .add(R.id.container, weatherDataFragment).commit();
+        // }
+        final WeatherDataFragment weatherDataFragment = (WeatherDataFragment) this
+                .getFragmentManager().findFragmentById(R.id.weather_data_frag);
 
         this.onclickButtons = weatherDataFragment;
     }