From 46dd60601c7e03a7c9727132eeb1005ae1767069 Mon Sep 17 00:00:00 2001 From: "gu.martinm@gmail.com" Date: Tue, 2 Sep 2014 19:08:19 +0200 Subject: [PATCH] WeatherInformation Android currentfragment without fragmentlist removing useless layout files --- .../res/layout/weather_current_data.xml | 18 - .../layout/weather_current_data_entry_fifth.xml | 456 ------------------- .../layout/weather_current_data_entry_first.xml | 51 --- .../layout/weather_current_data_entry_fourth.xml | 156 ------- .../layout/weather_current_data_entry_second.xml | 24 - .../layout/weather_current_data_entry_third.xml | 288 ------------ .../res/layout/weather_current_fragment.xml | 486 +++++++++++++++++++++ .../res/layout/weather_data_entry_list.xml | 23 - .../res/layout/weather_data_list.xml | 26 -- .../WeatherInformation/res/layout/weather_main.xml | 16 - .../res/layout/weather_specific_fragment.xml | 11 +- .../fragment/current/CurrentAdapter.java | 204 --------- .../fragment/current/CurrentDataEntryFifth.java | 71 --- .../fragment/current/CurrentDataEntryFirst.java | 28 -- .../fragment/current/CurrentDataEntrySecond.java | 14 - .../fragment/current/CurrentFragment.java | 82 ++-- .../fragment/specific/SpecificFragment.java | 6 +- 17 files changed, 541 insertions(+), 1419 deletions(-) delete mode 100644 Android/WeatherInformation/res/layout/weather_current_data.xml delete mode 100644 Android/WeatherInformation/res/layout/weather_current_data_entry_fifth.xml delete mode 100644 Android/WeatherInformation/res/layout/weather_current_data_entry_first.xml delete mode 100644 Android/WeatherInformation/res/layout/weather_current_data_entry_fourth.xml delete mode 100644 Android/WeatherInformation/res/layout/weather_current_data_entry_second.xml delete mode 100644 Android/WeatherInformation/res/layout/weather_current_data_entry_third.xml create mode 100644 Android/WeatherInformation/res/layout/weather_current_fragment.xml delete mode 100644 Android/WeatherInformation/res/layout/weather_data_entry_list.xml delete mode 100644 Android/WeatherInformation/res/layout/weather_data_list.xml delete mode 100644 Android/WeatherInformation/res/layout/weather_main.xml delete mode 100644 Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentAdapter.java delete mode 100644 Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntryFifth.java delete mode 100644 Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntryFirst.java delete mode 100644 Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntrySecond.java diff --git a/Android/WeatherInformation/res/layout/weather_current_data.xml b/Android/WeatherInformation/res/layout/weather_current_data.xml deleted file mode 100644 index 4e3b752..0000000 --- a/Android/WeatherInformation/res/layout/weather_current_data.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Android/WeatherInformation/res/layout/weather_current_data_entry_fifth.xml b/Android/WeatherInformation/res/layout/weather_current_data_entry_fifth.xml deleted file mode 100644 index 27c67d2..0000000 --- a/Android/WeatherInformation/res/layout/weather_current_data_entry_fifth.xml +++ /dev/null @@ -1,456 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Android/WeatherInformation/res/layout/weather_current_data_entry_first.xml b/Android/WeatherInformation/res/layout/weather_current_data_entry_first.xml deleted file mode 100644 index bbfb715..0000000 --- a/Android/WeatherInformation/res/layout/weather_current_data_entry_first.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - diff --git a/Android/WeatherInformation/res/layout/weather_current_data_entry_fourth.xml b/Android/WeatherInformation/res/layout/weather_current_data_entry_fourth.xml deleted file mode 100644 index da2d94e..0000000 --- a/Android/WeatherInformation/res/layout/weather_current_data_entry_fourth.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Android/WeatherInformation/res/layout/weather_current_data_entry_second.xml b/Android/WeatherInformation/res/layout/weather_current_data_entry_second.xml deleted file mode 100644 index 7c2fa49..0000000 --- a/Android/WeatherInformation/res/layout/weather_current_data_entry_second.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - diff --git a/Android/WeatherInformation/res/layout/weather_current_data_entry_third.xml b/Android/WeatherInformation/res/layout/weather_current_data_entry_third.xml deleted file mode 100644 index fa78a65..0000000 --- a/Android/WeatherInformation/res/layout/weather_current_data_entry_third.xml +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Android/WeatherInformation/res/layout/weather_current_fragment.xml b/Android/WeatherInformation/res/layout/weather_current_fragment.xml new file mode 100644 index 0000000..574348e --- /dev/null +++ b/Android/WeatherInformation/res/layout/weather_current_fragment.xml @@ -0,0 +1,486 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Android/WeatherInformation/res/layout/weather_data_entry_list.xml b/Android/WeatherInformation/res/layout/weather_data_entry_list.xml deleted file mode 100644 index 0f3cb7c..0000000 --- a/Android/WeatherInformation/res/layout/weather_data_entry_list.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - diff --git a/Android/WeatherInformation/res/layout/weather_data_list.xml b/Android/WeatherInformation/res/layout/weather_data_list.xml deleted file mode 100644 index 1abb201..0000000 --- a/Android/WeatherInformation/res/layout/weather_data_list.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - diff --git a/Android/WeatherInformation/res/layout/weather_main.xml b/Android/WeatherInformation/res/layout/weather_main.xml deleted file mode 100644 index 6c9ce95..0000000 --- a/Android/WeatherInformation/res/layout/weather_main.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Android/WeatherInformation/res/layout/weather_specific_fragment.xml b/Android/WeatherInformation/res/layout/weather_specific_fragment.xml index 0768ae8..cd349e2 100644 --- a/Android/WeatherInformation/res/layout/weather_specific_fragment.xml +++ b/Android/WeatherInformation/res/layout/weather_specific_fragment.xml @@ -4,6 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" > + @@ -173,7 +174,7 @@ android:textAlignment="textEnd" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" - android:layout_marginRight="5dp" + android:layout_marginEnd="5dp" android:textAppearance="?android:attr/textAppearanceSmall" android:textStyle="bold" /> @@ -224,7 +225,7 @@ android:textAlignment="textStart" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" - android:layout_marginRight="5dp" + android:layout_marginEnd="5dp" android:textAppearance="?android:attr/textAppearanceSmall" android:textStyle="bold" /> @@ -267,7 +268,7 @@ android:textAlignment="textEnd" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" - android:layout_marginRight="5dp" + android:layout_marginEnd="5dp" android:textAppearance="?android:attr/textAppearanceSmall" android:textStyle="bold" /> @@ -316,7 +317,7 @@ android:textAlignment="textStart" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" - android:layout_marginRight="5dp" + android:layout_marginEnd="5dp" android:textAppearance="?android:attr/textAppearanceSmall" android:textStyle="bold" /> diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentAdapter.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentAdapter.java deleted file mode 100644 index 2606f42..0000000 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentAdapter.java +++ /dev/null @@ -1,204 +0,0 @@ -package de.example.exampletdd.fragment.current; - -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.ImageView; -import android.widget.TextView; -import de.example.exampletdd.R; - -public class CurrentAdapter extends ArrayAdapter { - private static final int FIRST = 0; - private static final int SECOND = 1; - private static final int THIRD = 2; - private final int[] resources; - - public CurrentAdapter(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 CurrentDataEntryFirst entry = (CurrentDataEntryFirst) 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 CurrentDataEntrySecond entry = (CurrentDataEntrySecond) this - .getItem(position); - viewHolder.weatherDescription.setText(entry.getWeatherDescription()); - } else if (viewType == THIRD) { - final ViewThirdHolder viewHolder = this.getViewThirdHolder(view); - final CurrentDataEntryFifth entry = (CurrentDataEntryFifth) this - .getItem(position); - viewHolder.humidityValue.setText(entry.getHumidityValue()); - viewHolder.pressureValue.setText(entry.getPressureValue()); - viewHolder.rainValue.setText(entry.getRainValue()); - viewHolder.cloudsValue.setText(entry.getCloudsValue()); - viewHolder.windValue.setText(entry.getWindValue()); - viewHolder.sunRiseTime.setText(entry.getSunRiseTime()); - viewHolder.sunSetTime.setText(entry.getSunSetTime()); - viewHolder.feelsLike.setText(entry.getFeelsLike()); - viewHolder.snowValue.setText(entry.getSnowValue()); - viewHolder.feelsLikeUnits.setText(entry.getFeelsLikeUnits()); - } - - return view; - } - - @Override - public int getItemViewType(final int position) { - int type = 0; - - if (position == 0) { - type = FIRST; - } else if (position == 1) { - type = SECOND; - } else if (position == 2) { - type = THIRD; - } - - return type; - } - - @Override - public int getViewTypeCount() { - return 3; - } - - private View getWorkingView(final int position, final View convertView) { - View workingView = null; - - if (convertView == null) { - final int viewType = this.getItemViewType(position); - final Context context = this.getContext(); - final LayoutInflater inflater = (LayoutInflater) context - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - - workingView = inflater.inflate(this.resources[viewType], null); - } else { - workingView = convertView; - } - - return workingView; - } - - private ViewFirstHolder getViewFirstHolder(final View workingView) { - final Object tag = workingView.getTag(); - ViewFirstHolder viewHolder = null; - - if ((null == tag) || !(tag instanceof ViewFirstHolder)) { - viewHolder = new ViewFirstHolder(); - - viewHolder.picture = (ImageView) workingView - .findViewById(R.id.weather_current_data_picture); - viewHolder.tempMax = (TextView) workingView - .findViewById(R.id.weather_current_data_temp_max); - viewHolder.tempMin = (TextView) workingView - .findViewById(R.id.weather_current_data_temp_min); - - workingView.setTag(viewHolder); - - } else { - viewHolder = (ViewFirstHolder) tag; - } - - return viewHolder; - } - - private ViewSecondHolder getViewSecondHolder(final View workingView) { - final Object tag = workingView.getTag(); - ViewSecondHolder viewHolder = null; - - if ((null == tag) || !(tag instanceof ViewSecondHolder)) { - viewHolder = new ViewSecondHolder(); - - viewHolder.weatherDescription = (TextView) workingView - .findViewById(R.id.weather_current_data_description); - - workingView.setTag(viewHolder); - - } else { - viewHolder = (ViewSecondHolder) tag; - } - - return viewHolder; - } - - private ViewThirdHolder getViewThirdHolder(final View workingView) { - final Object tag = workingView.getTag(); - ViewThirdHolder viewHolder = null; - - if ((null == tag) || !(tag instanceof ViewThirdHolder)) { - viewHolder = new ViewThirdHolder(); - - viewHolder.humidityValue = (TextView) workingView - .findViewById(R.id.weather_current_now_data_humidity_value); - viewHolder.pressureValue = (TextView) workingView - .findViewById(R.id.weather_current_now_data_pressure_value); - viewHolder.rainValue = (TextView) workingView - .findViewById(R.id.weather_current_now_data_rain_value); - viewHolder.cloudsValue = (TextView) workingView - .findViewById(R.id.weather_current_now_data_clouds_value); - viewHolder.windValue = (TextView) workingView - .findViewById(R.id.weather_current_now_data_wind_value); - viewHolder.cloudsValue = (TextView) workingView - .findViewById(R.id.weather_current_now_data_clouds_value); - viewHolder.snowValue = (TextView) workingView - .findViewById(R.id.weather_current_now_data_snow_value); - viewHolder.sunRiseTime = (TextView) workingView - .findViewById(R.id.weather_current_now_data_sunrise_value); - viewHolder.sunSetTime = (TextView) workingView - .findViewById(R.id.weather_current_now_data_sunset_value); - viewHolder.feelsLike = (TextView) workingView - .findViewById(R.id.weather_current_now_data_feelslike_value); - viewHolder.feelsLikeUnits = (TextView) workingView - .findViewById(R.id.weather_current_now_data_feelslike_units); - - workingView.setTag(viewHolder); - - } else { - viewHolder = (ViewThirdHolder) tag; - } - - return viewHolder; - } - - - private static class ViewFirstHolder { - public ImageView picture; - public TextView tempMax; - public TextView tempMin; - } - - private static class ViewSecondHolder { - public TextView weatherDescription; - } - - private static class ViewThirdHolder { - public TextView humidityValue; - public TextView pressureValue; - public TextView windValue; - public TextView rainValue; - public TextView cloudsValue; - public TextView snowValue; - public TextView sunRiseTime; - public TextView sunSetTime; - public TextView feelsLike; - public TextView feelsLikeUnits; - } -} diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntryFifth.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntryFifth.java deleted file mode 100644 index dc1d50f..0000000 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntryFifth.java +++ /dev/null @@ -1,71 +0,0 @@ -package de.example.exampletdd.fragment.current; - -public class CurrentDataEntryFifth { - private final String sunRiseTime; - private final String sunSetTime; - private final String humidityValue; - private final String pressureValue; - private final String windValue; - private final String rainValue; - private final String cloudsValue; - private final String feelsLike; - private final String feelsLikeUnits; - private final String snowValue; - - public CurrentDataEntryFifth(final String sunRiseTime, final String sunSetTime, - final String humidityValue, final String pressureValue, final String windValue, - final String rainValue, final String feelsLike, final String feelsLikeUnits, - final String snowValue, - final String cloudsValue) { - this.sunRiseTime = sunRiseTime; - this.sunSetTime = sunSetTime; - this.humidityValue = humidityValue; - this.pressureValue = pressureValue; - this.windValue = windValue; - this.rainValue = rainValue; - this.feelsLike = feelsLike; - this.feelsLikeUnits = feelsLikeUnits; - this.snowValue = snowValue; - this.cloudsValue = cloudsValue; - } - - public String getSunRiseTime() { - return this.sunRiseTime; - } - - public String getSunSetTime() { - return this.sunSetTime; - } - - public String getFeelsLike() { - return this.feelsLike; - } - - public String getFeelsLikeUnits() { - return this.feelsLikeUnits; - } - - public String getHumidityValue() { - return this.humidityValue; - } - - public String getPressureValue() { - return this.pressureValue; - } - - public String getWindValue() { - return this.windValue; - } - - public String getRainValue() { - return this.rainValue; - } - - public String getCloudsValue() { - return this.cloudsValue; - } - - public String getSnowValue() { - return this.snowValue; - } -} diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntryFirst.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntryFirst.java deleted file mode 100644 index 21d6aba..0000000 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntryFirst.java +++ /dev/null @@ -1,28 +0,0 @@ -package de.example.exampletdd.fragment.current; - -import android.graphics.Bitmap; - -public class CurrentDataEntryFirst { - private final Bitmap picture; - private final String tempMax; - private final String tempMin; - - public CurrentDataEntryFirst(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/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntrySecond.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntrySecond.java deleted file mode 100644 index 8b89ac4..0000000 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentDataEntrySecond.java +++ /dev/null @@ -1,14 +0,0 @@ -package de.example.exampletdd.fragment.current; - -public class CurrentDataEntrySecond { - private final String weatherDescription; - - public CurrentDataEntrySecond(final String weatherDescription) { - this.weatherDescription = weatherDescription; - } - - public String getWeatherDescription() { - return this.weatherDescription; - } - -} diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentFragment.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentFragment.java index c0d4c03..0aa078e 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentFragment.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentFragment.java @@ -20,9 +20,13 @@ import android.net.http.AndroidHttpClient; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.v4.app.ListFragment; +import android.support.v4.app.Fragment; import android.util.Log; -import android.widget.ListView; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; import com.fasterxml.jackson.core.JsonParseException; @@ -35,7 +39,7 @@ import de.example.exampletdd.parser.JPOSWeatherParser; import de.example.exampletdd.service.IconsList; import de.example.exampletdd.service.ServiceParser; -public class CurrentFragment extends ListFragment { +public class CurrentFragment extends Fragment { private static final String TAG = "CurrentFragment"; @Override @@ -44,12 +48,17 @@ public class CurrentFragment extends ListFragment { } @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + // Inflate the layout for this fragment + return inflater.inflate(R.layout.weather_current_fragment, container, false); + } + + @Override 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 Current current = (Current) savedInstanceState.getSerializable("Current"); @@ -61,17 +70,7 @@ public class CurrentFragment extends ListFragment { (WeatherInformationApplication) getActivity().getApplication(); application.setCurrent(current); } - - // TODO: Why don't I need mListState? } - - // TODO: Why don't I need Adapter? - - this.setHasOptionsMenu(false); - // TODO: string static resource - this.setEmptyText("No data available"); - this.setListShown(true); - this.setListShownNoAnimation(true); } @Override @@ -156,14 +155,6 @@ public class CurrentFragment extends ListFragment { // 3. Prepare data for UI. - final int[] layouts = new int[3]; - layouts[0] = R.layout.weather_current_data_entry_first; - layouts[1] = R.layout.weather_current_data_entry_second; - layouts[2] = R.layout.weather_current_data_entry_fifth; - final CurrentAdapter adapter = new CurrentAdapter(this.getActivity(), - layouts); - - String tempMax = ""; if (current.getMain().getTemp_max() != null) { double conversion = (Double) current.getMain().getTemp_max(); @@ -187,18 +178,14 @@ public class CurrentFragment extends ListFragment { picture = BitmapFactory.decodeResource(this.getResources(), R.drawable.weather_severe_alert); } - final CurrentDataEntryFirst entryFirst = new CurrentDataEntryFirst(tempMax, - tempMin, picture); - adapter.add(entryFirst); + // TODO: static resource String description = "no description available"; if (current.getWeather().size() > 0) { description = current.getWeather().get(0).getDescription(); } - final CurrentDataEntrySecond entrySecond = new CurrentDataEntrySecond( - description); - adapter.add(entrySecond); + // TODO: units!!!! String humidityValue = ""; if ((current.getMain() != null) && (current.getMain().getHumidity() != null)) { @@ -253,15 +240,38 @@ public class CurrentFragment extends ListFragment { final Date unixDate = new Date(unixTime * 1000L); sunSetTime = dateFormat.format(unixDate); } - final CurrentDataEntryFifth entryFifth = new CurrentDataEntryFifth( - sunRiseTime, sunSetTime, humidityValue, pressureValue, windValue, rainValue, - feelsLike, symbol, snowValue, cloudsValue); - adapter.add(entryFifth); // 4. Update UI. - // TODO: Why am I not doing the same as in OverviewFragment? - this.setListAdapter(adapter); + final TextView tempMaxView = (TextView) getActivity().findViewById(R.id.weather_current_temp_max); + tempMaxView.setText(tempMax); + final TextView tempMinView = (TextView) getActivity().findViewById(R.id.weather_current_temp_min); + tempMinView.setText(tempMin); + final ImageView pictureView = (ImageView) getActivity().findViewById(R.id.weather_current_picture); + pictureView.setImageBitmap(picture); + + final TextView descriptionView = (TextView) getActivity().findViewById(R.id.weather_specific_description); + descriptionView.setText(description); + + final TextView humidityValueView = (TextView) getActivity().findViewById(R.id.weather_current_humidity_value); + humidityValueView.setText(humidityValue); + final TextView pressureValueView = (TextView) getActivity().findViewById(R.id.weather_current_pressure_value); + pressureValueView.setText(pressureValue); + final TextView windValueView = (TextView) getActivity().findViewById(R.id.weather_current_wind_value); + windValueView.setText(windValue); + final TextView rainValueView = (TextView) getActivity().findViewById(R.id.weather_current_rain_value); + rainValueView.setText(rainValue); + final TextView cloudsValueView = (TextView) getActivity().findViewById(R.id.weather_current_clouds_value); + cloudsValueView.setText(cloudsValue); + final TextView snowValueView = (TextView) getActivity().findViewById(R.id.weather_current_snow_value); + snowValueView.setText(snowValue); + final TextView feelsLikeView = (TextView) getActivity().findViewById(R.id.weather_current_feelslike_value); + feelsLikeView.setText(feelsLike); + + final TextView sunRiseTimeView = (TextView) getActivity().findViewById(R.id.weather_current_sunrise_value); + sunRiseTimeView.setText(sunRiseTime); + final TextView sunSetTimeView = (TextView) getActivity().findViewById(R.id.weather_current_sunset_value); + sunSetTimeView.setText(sunSetTime); } private class CurrentTask extends AsyncTask { diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/specific/SpecificFragment.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/specific/SpecificFragment.java index e0d67fd..4a1dc3f 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/specific/SpecificFragment.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/fragment/specific/SpecificFragment.java @@ -75,7 +75,6 @@ public class SpecificFragment extends Fragment { } this.mChosenDay = savedInstanceState.getInt("Chosen day"); - // TODO: Why don't I need mListState? } } @@ -181,8 +180,6 @@ public class SpecificFragment extends Fragment { if (forecast.getWeather().size() > 0) { description = forecast.getWeather().get(0).getDescription(); } - final TextView descriptionView = (TextView) getActivity().findViewById(R.id.weather_specific_description); - descriptionView.setText(description); // TODO: units!!!! String humidityValue = ""; @@ -247,6 +244,9 @@ public class SpecificFragment extends Fragment { final ImageView pictureView = (ImageView) getActivity().findViewById(R.id.weather_specific_picture); pictureView.setImageBitmap(picture); + final TextView descriptionView = (TextView) getActivity().findViewById(R.id.weather_specific_description); + descriptionView.setText(description); + 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); -- 2.1.4