android:value="@integer/google_play_services_version" />
<activity
- android:name="de.example.exampletdd.TestScrollActivity"
- android:label="@string/title_activity_test_scroll"
- android:parentActivityName="de.example.exampletdd.WeatherInformationActivity" >
- </activity>
- <activity
android:name="de.example.exampletdd.MasterDetailListActivity"
android:label="@string/title_masterdetail_list" >
</activity>
+++ /dev/null
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context="de.example.exampletdd.TestScrollActivity"
- tools:ignore="MergeRootFrame" >
-
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="top|center"
- android:orientation="horizontal">
-
- <ImageView
- android:id="@+id/weather_current_picture"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|center"
- android:layout_centerHorizontal="true"
- android:contentDescription="@string/icon_weather_description"
- android:maxHeight="380dp"
- android:maxWidth="380dp"
- android:minHeight="180dp"
- android:minWidth="180dp"
- android:src="@drawable/weather_snow" />
-
- <!-- Temperature Max-->
- <TextView
- android:id="@+id/weather_max_temperature"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="55ºC"
- android:textAlignment="center"
- android:layout_toRightOf="@id/weather_current_picture"
- android:layout_alignTop="@id/weather_current_picture"
- android:layout_margin="10dp"
- android:layout_gravity="top|center"
- android:layout_centerHorizontal="true"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textStyle="bold" />
-
- <!-- Temperature Min-->
- <TextView
- android:id="@+id/weather_min_temperature"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="55ºC"
- android:textAlignment="center"
- android:layout_toRightOf="@id/weather_current_picture"
- android:layout_below="@+id/weather_max_temperature"
- android:layout_margin="10dp"
- android:layout_gravity="top|center"
- android:layout_centerHorizontal="true"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <!-- Weather description-->
- <TextView
- android:id="@+id/weather_description"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Light rain"
- android:textAlignment="center"
- android:textColor="@color/weather_time_of_day_color_title"
- android:layout_below="@+id/weather_current_picture"
- android:layout_margin="5dp"
- android:textStyle="bold"
- android:textAppearance="?android:attr/textAppearanceLarge" />
-
-
-
-
-
- <!-- Humidity -->
- <TextView
- android:id="@+id/weather_humidity"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="HUMIDITY"
- android:gravity="left"
- android:layout_alignParentLeft="true"
- android:textAlignment="center"
- android:layout_below="@+id/weather_description"
- android:layout_margin="10dp"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <!-- Wind -->
- <TextView
- android:id="@+id/weather_wind"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="WIND"
- android:gravity="right"
- android:layout_alignParentRight="true"
- android:layout_below="@+id/weather_description"
- android:layout_toRightOf="@id/weather_humidity"
- android:textAlignment="center"
- android:layout_margin="10dp"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <!-- Pressure -->
- <TextView
- android:id="@+id/weather_pressure"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="PRESSURE"
- android:gravity="left"
- android:layout_alignParentLeft="true"
- android:textAlignment="center"
- android:layout_below="@+id/weather_humidity"
- android:layout_margin="10dp"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <!-- Rain -->
- <TextView
- android:id="@+id/weather_rain"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="RAIN"
- android:gravity="right"
- android:layout_alignParentRight="true"
- android:layout_below="@+id/weather_wind"
- android:layout_toRightOf="@id/weather_humidity"
- android:textAlignment="center"
- android:layout_margin="10dp"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- </RelativeLayout>
-
- <HorizontalScrollView
- android:layout_width="fill_parent"
- android:layout_gravity="bottom"
- android:layout_height="150dp" >
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal" >
-
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <!-- Thermometer -->
- <ImageView
- android:id="@+id/thermometer"
- 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"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:text="55ºC"
- android:textAlignment="center"
- android:gravity="center|center_vertical"
- android:layout_below="@+id/weather_morn"
- android:layout_toRightOf="@id/thermometer"
- android:layout_alignTop="@id/thermometer"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textStyle="bold" />
-
- <!-- Time of day -->
-
- <TextView
- android:id="@+id/weather_morn"
- android:layout_width="140dp"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:gravity="center"
- android:selectAllOnFocus="true"
- android:text="DAY"
- android:textColor="@color/weather_time_of_day_color_title"
- android:textAlignment="center"
- android:textAppearance="?android:attr/textAppearanceLarge" />
-
- </RelativeLayout>
-
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <!-- Thermometer -->
- <ImageView
- android:id="@+id/thermometer"
- 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"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:text="55ºC"
- android:textAlignment="center"
- android:gravity="center|center_vertical"
- android:layout_below="@+id/weather_morn"
- android:layout_toRightOf="@id/thermometer"
- android:layout_alignTop="@id/thermometer"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textStyle="bold" />
-
- <!-- Time of day -->
- <TextView
- android:id="@+id/weather_morn"
- android:layout_width="140dp"
- android:layout_height="wrap_content"
- android:text="MORNING"
- android:textColor="@color/weather_time_of_day_color_title"
- android:textAlignment="center"
- android:gravity="center"
- android:layout_alignParentTop="true"
- android:textAppearance="?android:attr/textAppearanceLarge" />
-
- </RelativeLayout>
-
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <!-- Thermometer -->
- <ImageView
- android:id="@+id/thermometer"
- 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"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:text="55ºC"
- android:textAlignment="center"
- android:gravity="center|center_vertical"
- android:layout_below="@+id/weather_morn"
- android:layout_toRightOf="@id/thermometer"
- android:layout_alignTop="@id/thermometer"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textStyle="bold" />
-
- <!-- Time of day -->
- <TextView
- android:id="@+id/weather_morn"
- android:layout_width="140dp"
- android:layout_height="wrap_content"
- android:text="EVENING"
- android:textColor="@color/weather_time_of_day_color_title"
- android:textAlignment="center"
- android:gravity="center"
- android:layout_alignParentTop="true"
- android:textAppearance="?android:attr/textAppearanceLarge" />
-
- </RelativeLayout>
-
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <!-- Thermometer -->
- <ImageView
- android:id="@+id/thermometer"
- 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"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:text="55ºC"
- android:textAlignment="center"
- android:gravity="center|center_vertical"
- android:layout_below="@+id/weather_morn"
- android:layout_toRightOf="@id/thermometer"
- android:layout_alignTop="@id/thermometer"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textStyle="bold" />
-
- <!-- Time of day -->
- <TextView
- android:id="@+id/weather_morn"
- android:layout_width="140dp"
- android:layout_height="wrap_content"
- android:text="NIGHT"
- android:textColor="@color/weather_time_of_day_color_title"
- android:textAlignment="center"
- android:gravity="center"
- android:layout_alignParentTop="true"
- android:textAppearance="?android:attr/textAppearanceLarge" />
-
- </RelativeLayout>
-
- </LinearLayout>
- </HorizontalScrollView>
-
-</FrameLayout>
\ No newline at end of file
+++ /dev/null
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context="de.example.exampletdd.TestScrollActivity$PlaceholderFragment" >
-
- <TextView
- android:id="@+id/section_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
-
-</RelativeLayout>
--- /dev/null
+<?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:padding="50dp"
+ android:gravity="center"
+ android:layout_gravity="center"
+ android:orientation="horizontal" >
+
+ <ImageView
+ android:id="@+id/weather_current_data_picture"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:contentDescription="@string/icon_weather_description"
+ android:scaleType="fitCenter"
+ android:maxHeight="580dp"
+ android:maxWidth="580dp"
+ android:minHeight="80dp"
+ android:minWidth="80dp"
+ android:src="@drawable/weather_showers" />
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:layout_gravity="center"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/weather_current_data_temp_max"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAlignment="textStart"
+ android:paddingLeft="20dp"
+ android:text="55ºC"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/weather_current_data_temp_min"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAlignment="textStart"
+ android:paddingLeft="20dp"
+ android:text="55ºC"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textStyle="normal" />
+
+ </LinearLayout>
+
+</LinearLayout>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_gravity="center"
+ android:layout_height="80dp" >
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
+
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ 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"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="55ºC"
+ 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:textAppearance="?android:attr/textAppearanceMedium"
+ android:textStyle="bold" />
+
+ <!-- Time of day -->
+ <TextView
+ android:id="@+id/weather_morn"
+ android:layout_width="140dp"
+ android:layout_height="wrap_content"
+ android:text="MORNING"
+ android:textColor="@color/weather_time_of_day_color_title"
+ android:textAlignment="center"
+ android:gravity="center"
+ android:layout_alignParentTop="true"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ 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
+ android:id="@+id/weather_day_temperature"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="55ºC"
+ 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:textAppearance="?android:attr/textAppearanceMedium"
+ android:textStyle="bold" />
+
+ <!-- Time of day -->
+ <TextView
+ android:id="@+id/weather_day"
+ android:layout_width="140dp"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:gravity="center"
+ android:selectAllOnFocus="true"
+ android:text="DAY"
+ android:textColor="@color/weather_time_of_day_color_title"
+ android:textAlignment="center"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+ </RelativeLayout>
+
+
+
+
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ 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:id="@+id/weather_eve_temperature"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="55ºC"
+ 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:textAppearance="?android:attr/textAppearanceMedium"
+ android:textStyle="bold" />
+
+ <!-- Time of day -->
+ <TextView
+ android:id="@+id/weather_eve"
+ android:layout_width="140dp"
+ android:layout_height="wrap_content"
+ android:text="EVENING"
+ android:textColor="@color/weather_time_of_day_color_title"
+ android:textAlignment="center"
+ android:gravity="center"
+ android:layout_alignParentTop="true"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ </RelativeLayout>
+
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ 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:id="@+id/weather_night_temperature"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:text="55ºC"
+ 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:textAppearance="?android:attr/textAppearanceMedium"
+ android:textStyle="bold" />
+
+ <!-- Time of day -->
+ <TextView
+ android:id="@+id/weather_night"
+ android:layout_width="140dp"
+ android:layout_height="wrap_content"
+ android:text="NIGHT"
+ android:textColor="@color/weather_time_of_day_color_title"
+ android:textAlignment="center"
+ android:gravity="center"
+ android:layout_alignParentTop="true"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ </RelativeLayout>
+
+ </LinearLayout>
+
+</HorizontalScrollView>
--- /dev/null
+<?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="horizontal" >
+
+ <TextView
+ android:id="@+id/weather_current_data_description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:layout_gravity="center"
+ android:textAlignment="textStart"
+ android:paddingBottom="50dp"
+ android:paddingRight="50dp"
+ android:paddingLeft="50dp"
+ android:text="Light rain"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="@color/weather_time_of_day_color_title"
+ android:textStyle="bold" />
+
+</LinearLayout>
--- /dev/null
+<?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" >
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="20dp"
+ android:orientation="vertical" >
+
+ <!-- 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:textAppearance="?android:attr/textAppearanceMedium"
+ android:textStyle="bold" />
+
+ <!-- Humidity Value-->
+ <TextView
+ android:id="@+id/weather_current_data_humidity_value"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="83"
+ android:layout_gravity="left"
+ android:gravity="left"
+ android:layout_toRightOf="@+id/weather_current_data_humidity"
+ android:textAlignment="center"
+ android:layout_marginTop="5dp"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textStyle="normal" />
+
+ <!-- Humidity Units-->
+ <TextView
+ android:id="@+id/weather_current_data_humidity_units"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ 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:layout_marginTop="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 -->
+ <TextView
+ android:id="@+id/weather_current_data_rain"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="RAIN"
+ android:layout_gravity="left"
+ android:gravity="left"
+ android:layout_alignParentLeft="true"
+ android:textAlignment="center"
+ 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" />
+
+ <!-- Rain Value-->
+ <TextView
+ android:id="@+id/weather_current_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:textAlignment="center"
+ android:layout_toRightOf="@+id/weather_current_data_rain"
+ android:paddingTop="20dp"
+ android:paddingBottom="20dp"
+ android:layout_marginTop="5dp"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textStyle="normal" />
+
+ <!-- Rain Units -->
+ <TextView
+ android:id="@+id/weather_current_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: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:textAppearance="?android:attr/textAppearanceSmall"
+ android:textStyle="bold" />
+
+
+ <!-- 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:layout_alignParentRight="true"
+ android:textAlignment="center"
+ 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 -->
+ <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:layout_toLeftOf="@+id/weather_current_data_clouds"
+ android:textAlignment="center"
+ android:paddingTop="20dp"
+ android:paddingBottom="20dp"
+ android:layout_marginTop="5dp"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textStyle="bold" />
+
+ <!-- Clouds Value-->
+ <TextView
+ android:id="@+id/weather_current_data_clouds_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_clouds_units"
+ android:textAlignment="center"
+ android:paddingTop="20dp"
+ android:paddingBottom="20dp"
+ android:layout_marginTop="5dp"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textStyle="normal" />
+
+ </RelativeLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:layout_gravity="center"
+ android:orientation="horizontal" >
+
+ <!-- Pressure -->
+ <TextView
+ android:id="@+id/weather_current_data_pressure"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="PRESSURE"
+ android:layout_gravity="left"
+ android:gravity="left"
+ android:textAlignment="center"
+ 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" />
+
+ <!-- Pressure Value-->
+ <TextView
+ android:id="@+id/weather_current_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="center"
+ android:paddingTop="20dp"
+ android:paddingBottom="20dp"
+ android:layout_marginTop="5dp"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textStyle="normal" />
+
+ <!-- Pressure Units-->
+ <TextView
+ android:id="@+id/weather_current_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="center"
+ android:paddingTop="20dp"
+ android:paddingRight="20dp"
+ android:paddingBottom="20dp"
+ android:layout_marginTop="5dp"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textStyle="bold" />
+
+ </LinearLayout>
+
+</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:baselineAligned="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:padding="15dp"
+ android:layout_gravity="center_horizontal"
+ android:orientation="horizontal"
+ android:padding="5dp" >
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:layout_gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/weather_main_entry_date_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_above="@+id/weather_main_entry_date_number"
- android:layout_alignParentLeft="true"
- android:layout_alignBottom="@+id/weather_main_entry_temperature_max"
- android:layout_alignTop="@+id/weather_main_entry_temperature_max"
+ android:layout_gravity="center"
android:text="SUN"
android:textAlignment="center"
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
+
<TextView
android:id="@+id/weather_main_entry_date_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignBottom="@+id/weather_main_entry_temperature_min"
- android:layout_alignParentLeft="true"
- android:layout_alignTop="@+id/weather_main_entry_temperature_min"
+ android:layout_gravity="center"
android:text="APR 23"
android:textAlignment="center"
android:textAllCaps="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="normal" />
+
+ </LinearLayout>
+
- <TextView
- android:id="@+id/weather_main_entry_temperature_max"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignTop="@+id/weather_main_entry_image"
- android:layout_centerHorizontal="true"
- android:text="12ºC"
- android:textAlignment="center"
- android:textAllCaps="true"
- android:textColor="@color/weather_time_of_day_color_title"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textStyle="bold" />
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="match_parent"
+ android:gravity="center"
+ android:layout_gravity="center"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/weather_main_entry_temperature_max"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="12ºC"
+ android:textAlignment="center"
+ android:textAllCaps="true"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/weather_time_of_day_color_title"
+ android:textStyle="bold" />
<TextView
android:id="@+id/weather_main_entry_temperature_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_below="@+id/weather_main_entry_temperature_max"
- android:layout_alignBottom="@+id/weather_main_entry_image"
- android:layout_centerHorizontal="true"
+ android:layout_gravity="center"
android:text="5ºC"
android:textAlignment="center"
android:textAllCaps="true"
- android:textColor="@color/weather_time_of_day_color_title"
android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/weather_time_of_day_color_title"
android:textStyle="normal" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:orientation="vertical" >
+
<ImageView
android:id="@+id/weather_main_entry_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
+ android:layout_gravity="center"
android:contentDescription="@string/icon_weather_description"
android:orientation="vertical"
android:src="@drawable/ic_launcher" />
+
+ </LinearLayout>
-</RelativeLayout>
\ No newline at end of file
+</LinearLayout>
\ No newline at end of file
tools:context="de.example.exampletdd.WeatherInformationSpecificDataActivity"
tools:ignore="MergeRootFrame" >
- <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:src="@drawable/ic_launcher" />
<fragment
android:id="@+id/weather_specific_data_fragment"
+++ /dev/null
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- tools:context="de.example.exampletdd.TestScrollActivity" >
-
- <item
- android:id="@+id/action_settings"
- android:orderInCategory="100"
- android:showAsAction="never"
- android:title="@string/action_settings"/>
-
-</menu>
</item>
<item
android:id="@+id/weather_menu_map"
- android:icon="@drawable/ic_action_place"
+ android:icon="@drawable/ic_action_map"
android:showAsAction="ifRoom"
android:visible="true"
android:checkable="false"
<string name="country_not_found">country not found</string>
<string name="progress_dialog_get_remote_data">Downloading remote data</string>
<string name="progress_dialog_generic_message">Please wait…</string>
- <string name="title_activity_test_scroll">TestScrollActivity</string>
<string name="title_section1">Section 1</string>
<string name="title_section2">Section 2</string>
<string name="title_section3">Section 3</string>
+++ /dev/null
-package de.example.exampletdd;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.Fragment;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
-
-public class TestScrollActivity extends Activity implements ActionBar.OnNavigationListener {
-
- /**
- * The serialization (saved instance state) Bundle key representing the
- * current dropdown position.
- */
- private static final String STATE_SELECTED_NAVIGATION_ITEM = "selected_navigation_item";
-
- @Override
- protected void onCreate(final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.setContentView(R.layout.activity_test_scroll);
-
- // Set up the action bar to show a dropdown list.
- final ActionBar actionBar = this.getActionBar();
- actionBar.setDisplayShowTitleEnabled(false);
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
-
- // Set up the dropdown list navigation in the action bar.
- actionBar.setListNavigationCallbacks(
- // Specify a SpinnerAdapter to populate the dropdown list.
- new ArrayAdapter<String>(actionBar.getThemedContext(),
- android.R.layout.simple_list_item_1, android.R.id.text1, new String[] {
- this.getString(R.string.title_section1),
- this.getString(R.string.title_section2),
- this.getString(R.string.title_section3), }), this);
- }
-
- @Override
- public void onRestoreInstanceState(final Bundle savedInstanceState) {
- // Restore the previously serialized current dropdown position.
- if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) {
- this.getActionBar().setSelectedNavigationItem(
- savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM));
- }
- }
-
- @Override
- public void onSaveInstanceState(final Bundle outState) {
- // Serialize the current dropdown position.
- outState.putInt(STATE_SELECTED_NAVIGATION_ITEM, this.getActionBar().getSelectedNavigationIndex());
- }
-
- @Override
- public boolean onCreateOptionsMenu(final Menu menu) {
-
- // Inflate the menu; this adds items to the action bar if it is present.
- this.getMenuInflater().inflate(R.menu.test_scroll, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(final MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- final int id = item.getItemId();
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-
- @Override
- public boolean onNavigationItemSelected(final int position, final long id) {
- // When the given dropdown item is selected, show its contents in the
- // container view.
- // getFragmentManager().beginTransaction()
- // .replace(R.id.container, PlaceholderFragment.newInstance(position +
- // 1)).commit();
- return true;
- }
-
- /**
- * A placeholder fragment containing a simple view.
- */
- public static class PlaceholderFragment extends Fragment {
- /**
- * The fragment argument representing the section number for this
- * fragment.
- */
- private static final String ARG_SECTION_NUMBER = "section_number";
-
- /**
- * Returns a new instance of this fragment for the given section number.
- */
- public static PlaceholderFragment newInstance(final int sectionNumber) {
- final PlaceholderFragment fragment = new PlaceholderFragment();
- final Bundle args = new Bundle();
- args.putInt(ARG_SECTION_NUMBER, sectionNumber);
- fragment.setArguments(args);
- return fragment;
- }
-
- public PlaceholderFragment() {
- }
-
- @Override
- public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
- final Bundle savedInstanceState) {
- final View rootView = inflater.inflate(R.layout.fragment_test_scroll, container, false);
- final TextView textView = (TextView) rootView.findViewById(R.id.section_label);
- textView.setText(Integer.toString(this.getArguments().getInt(ARG_SECTION_NUMBER)));
- return rootView;
- }
- }
-
-}
} else if (itemId == R.id.weather_menu_current) {
intent = new Intent("de.example.exampletdd.WEATHERINFO")
.setComponent(new ComponentName("de.example.exampletdd",
- "de.example.exampletdd.TestScrollActivity"));
+ "de.example.exampletdd.WeatherInformationCurrentDataActivity"));
this.startActivity(intent);
return true;
} else {
.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("Current weather data information");
- actionBar.setSubtitle(city + "," + country);
+ actionBar.setTitle(city + "," + country);
+ actionBar.setSubtitle("CURRENTLY");
}
}
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // final SharedPreferences sharedPreferences = PreferenceManager
- // .getDefaultSharedPreferences(this.getActivity());
- // final String keyPreference = this.getResources().getString(
- // R.string.weather_preferences_language_key);
- // this.mLanguage = sharedPreferences.getString(
- // keyPreference, "");
-
this.mWeatherServicePersistenceFile = new WeatherServicePersistenceFile(this.getActivity());
this.mWeatherServicePersistenceFile.removeCurrentWeatherData();
}
this.setHasOptionsMenu(false);
- final WeatherSpecificDataAdapter adapter = new WeatherSpecificDataAdapter(
- this.getActivity(), R.layout.weather_data_entry_list);
-
-
this.setEmptyText("No data available");
- this.setListAdapter(adapter);
- this.setListShown(true);
- this.setListShownNoAnimation(true);
-
+ this.setListShownNoAnimation(false);
}
@Override
if (currentWeatherData != null) {
this.updateCurrentWeatherData(currentWeatherData);
} else {
- // 2.1 Empty list by default
- final WeatherSpecificDataAdapter adapter = new WeatherSpecificDataAdapter(
- this.getActivity(), R.layout.weather_data_entry_list);
- this.setListAdapter(adapter);
-
- // 2.2. Try to update weather data on display with remote
- // information.
+ // 3. Try to update weather data on display with remote
this.getRemoteCurrentWeatherInformation();
}
-
-
-
- // 3. If language changed, try to retrieve new data for new language
- // (new strings with the chosen language)
- // keyPreference = this.getResources().getString(
- // R.string.weather_preferences_language_key);
- // final String languagePreferenceValue = sharedPreferences.getString(
- // keyPreference, "");
- // if (!languagePreferenceValue.equals(this.mLanguage)) {
- // this.mLanguage = languagePreferenceValue;
- // this.getWeather();
- // }
}
@Override
try {
this.onPostExecuteThrowable(currentWeatherData);
} catch (final IOException e) {
+ WeatherInformationCurrentDataFragment.this.setListShown(true);
Log.e(TAG, "WeatherTask onPostExecute exception: ", e);
final DialogFragment newFragment = ErrorDialogFragment
.newInstance(R.string.error_dialog_generic_error);
"errorDialog");
}
} else {
+ WeatherInformationCurrentDataFragment.this.setListShown(true);
final DialogFragment newFragment = ErrorDialogFragment
.newInstance(R.string.error_dialog_generic_error);
newFragment.show(WeatherInformationCurrentDataFragment.this.getFragmentManager(),
private CurrentWeatherData doInBackgroundThrowable(final Object... params)
throws ClientProtocolException, MalformedURLException, URISyntaxException,
JsonParseException, IOException {
- // final SharedPreferences sharedPreferences = PreferenceManager
- // .getDefaultSharedPreferences(WeatherInformationCurrentDataFragment.this
- // .getActivity());
- //
- // final String keyPreference =
- // WeatherInformationCurrentDataFragment.this
- // .getActivity().getString(
- // R.string.weather_preferences_language_key);
- // final String languagePreferenceValue =
- // sharedPreferences.getString(keyPreference, "");
// 1. Coordinates
final GeocodingData geocodingData = (GeocodingData) params[0];
--- /dev/null
+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 WeatherCurrentDataAdapter 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 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 WeatherCurrentDataEntryThird entry = (WeatherCurrentDataEntryThird) 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 WeatherCurrentDataEntryFourth entry = (WeatherCurrentDataEntryFourth) 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;
+ }
+}
--- /dev/null
+package de.example.exampletdd.fragment.specific;
+
+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;
+ }
+}
--- /dev/null
+package de.example.exampletdd.fragment.specific;
+
+public class WeatherCurrentDataEntryFourth {
+ private final String morningTemp;
+ private final String dayTemp;
+ private final String eveTemp;
+ private final String nightTemp;
+
+ public WeatherCurrentDataEntryFourth(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;
+ }
+
+}
--- /dev/null
+package de.example.exampletdd.fragment.specific;
+
+public class WeatherCurrentDataEntrySecond {
+ private final String weatherDescription;
+
+ public WeatherCurrentDataEntrySecond(final String weatherDescription) {
+ this.weatherDescription = weatherDescription;
+ }
+
+ public String getWeatherDescription() {
+ return this.weatherDescription;
+ }
+
+}
--- /dev/null
+package de.example.exampletdd.fragment.specific;
+
+public class WeatherCurrentDataEntryThird {
+ private final String humidityValue;
+ private final String pressureValue;
+ private final String windValue;
+ private final String rainValue;
+ private final String cloudsValue;
+
+ public WeatherCurrentDataEntryThird(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;
+ }
+
+}
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 android.app.DialogFragment;
import android.app.ListFragment;
import android.content.SharedPreferences;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.widget.ListView;
import de.example.exampletdd.R;
import de.example.exampletdd.activityinterface.GetWeather;
import de.example.exampletdd.fragment.ErrorDialogFragment;
+import de.example.exampletdd.fragment.overview.IconsList;
import de.example.exampletdd.model.forecastweather.ForecastWeatherData;
import de.example.exampletdd.service.WeatherServicePersistenceFile;
this.mWeatherServicePersistenceFile = new WeatherServicePersistenceFile(
this.getActivity());
-
- // final SharedPreferences sharedPreferences = PreferenceManager
- // .getDefaultSharedPreferences(this.getActivity());
- // final String keyPreference = this.getResources().getString(
- // R.string.weather_preferences_language_key);
- // this.mLanguage = sharedPreferences.getString(
- // keyPreference, "");
}
@Override
final ListView listWeatherView = this.getListView();
listWeatherView.setChoiceMode(ListView.CHOICE_MODE_NONE);
- final WeatherSpecificDataAdapter adapter = new WeatherSpecificDataAdapter(this.getActivity(),
- R.layout.weather_data_entry_list);
-
this.setEmptyText("No data available");
- this.setListAdapter(adapter);
- this.setListShown(true);
- this.setListShownNoAnimation(true);
+ this.setListShownNoAnimation(false);
if (savedInstanceState != null) {
// Restore state
.getDefault());
tempFormatter.applyPattern("#####.#####");
final double tempUnits = this.mIsFahrenheit ? 0 : 273.15;
+ final String symbol = this.mIsFahrenheit ? "ºF" : "ºC";
- final List<WeatherSpecificDataEntry> entries = this.createEmptyEntriesList();
- final WeatherSpecificDataAdapter adapter = new WeatherSpecificDataAdapter(
- this.getActivity(), R.layout.weather_data_entry_list);
+ 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 WeatherCurrentDataAdapter adapter = new WeatherCurrentDataAdapter(this.getActivity(),
+ layouts);
final de.example.exampletdd.model.forecastweather.List forecast = forecastWeatherData
final Date date = calendar.getTime();
this.getActivity().getActionBar().setSubtitle(dayFormatter.format(date).toUpperCase());
- if (forecast.getWeather().size() > 0) {
- entries.set(0,
- new WeatherSpecificDataEntry(this.getString(R.string.text_field_description),
- forecast.getWeather().get(0).getDescription()));
- }
-
- if (forecast.getTemp().getDay() != null) {
- double conversion = (Double) forecast.getTemp().getDay();
- conversion = conversion - tempUnits;
- entries.set(1, new WeatherSpecificDataEntry(this.getString(R.string.text_field_tem),
- tempFormatter.format(conversion)));
- }
+ String tempMax = "";
if (forecast.getTemp().getMax() != null) {
double conversion = (Double) forecast.getTemp().getMax();
conversion = conversion - tempUnits;
- entries.set(2, new WeatherSpecificDataEntry(
- this.getString(R.string.text_field_tem_max), tempFormatter.format(conversion)));
+ tempMax = tempFormatter.format(conversion) + symbol;
}
-
+ String tempMin = "";
if (forecast.getTemp().getMin() != null) {
double conversion = (Double) forecast.getTemp().getMin();
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 ((forecast.getWeather().size() > 0) && (forecast.getWeather().get(0).getIcon() != null)
+ && (IconsList.getIcon(forecast.getWeather().get(0).getIcon()) != null)) {
+ final String icon = forecast.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 (forecast.getWeather().size() > 0) {
+ description = forecast.getWeather().get(0).getDescription();
+ }
+ final WeatherCurrentDataEntrySecond entrySecond = new WeatherCurrentDataEntrySecond(
+ description);
+ adapter.add(entrySecond);
+
+
+ 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();
+ pressureValue = tempFormatter.format(conversion);
+ }
+ String windValue = "";
+ if (forecast.getSpeed() != null) {
+ final double conversion = (Double) forecast.getSpeed();
+ windValue = tempFormatter.format(conversion);
+ }
+ String rainValue = "";
+ if (forecast.getRain() != null) {
+ final double conversion = (Double) forecast.getRain();
+ rainValue = tempFormatter.format(conversion);
+ }
+ String cloudsValue = "";
+ if (forecast.getRain() != null) {
+ final double conversion = (Double) forecast.getClouds();
+ cloudsValue = tempFormatter.format(conversion);
+ }
+ final WeatherCurrentDataEntryThird entryThird = new WeatherCurrentDataEntryThird(
+ humidityValue, pressureValue, windValue, rainValue, cloudsValue);
+ adapter.add(entryThird);
- if (forecast.getClouds() != null) {
- final double cloudiness = (Double) forecast.getClouds();
- entries.set(6,
- new WeatherSpecificDataEntry(this.getString(R.string.text_field_cloudiness),
- tempFormatter.format(cloudiness)));
+ String tempDay = "";
+ if (forecast.getTemp().getDay() != null) {
+ double conversion = (Double) forecast.getTemp().getDay();
+ conversion = conversion - tempUnits;
+ tempDay = tempFormatter.format(conversion) + symbol;
+ }
+ String tempMorn = "";
+ if (forecast.getTemp().getMorn() != null) {
+ double conversion = (Double) forecast.getTemp().getMorn();
+ conversion = conversion - tempUnits;
+ tempMorn = tempFormatter.format(conversion) + symbol;
+ }
+ String tempEve = "";
+ if (forecast.getTemp().getEve() != null) {
+ 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 WeatherCurrentDataEntryFourth entryFourth = new WeatherCurrentDataEntryFourth(
+ tempMorn, tempDay, tempEve, tempNight);
+ adapter.add(entryFourth);
- adapter.addAll(entries);
this.setListAdapter(adapter);
}
// 2. Update weather data on display.
-
final ForecastWeatherData forecastWeatherData = this.mWeatherServicePersistenceFile
.getForecastWeatherData();
if (forecastWeatherData != null) {
this.updateForecastWeatherData(forecastWeatherData, this.mChosenDay);
- } else {
- // 2.1 Empty list by default
- final WeatherSpecificDataAdapter adapter = new WeatherSpecificDataAdapter(
- this.getActivity(), R.layout.weather_data_entry_list);
- this.setListAdapter(adapter);
}
-
-
-
- // 3. If language changed, try to retrieve new data for new language
- // (new strings with the chosen language)
- // keyPreference = this.getResources().getString(
- // R.string.weather_preferences_language_key);
- // final String languagePreferenceValue = sharedPreferences.getString(
- // keyPreference, "");
- // if (!languagePreferenceValue.equals(this.mLanguage)) {
- // this.mLanguage = languagePreferenceValue;
- // this.getWeather();
- // }
- }
-
- 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;
}
}
import android.widget.ArrayAdapter;
import android.widget.TextView;
import de.example.exampletdd.R;
-import de.example.exampletdd.fragment.specific.WeatherSpecificDataEntry;
public class WeatherSpecificDataAdapter extends ArrayAdapter<WeatherSpecificDataEntry> {
private final int resource;