super.onResume();
final ActionBar actionBar = this.getActionBar();
- // TODO: string resource
- actionBar.setTitle("Mark your location");
+ actionBar.setTitle(this.getString(R.string.weather_map_mark_location));
WeatherLocation weatherLocation;
if (this.mRestoreUI != null) {
this.mLocationManager.requestSingleUpdate(criteria, this, null);
} else {
- // TODO: string resource
Toast.makeText(this, this.getString(R.string.weather_map_not_enabled_location), Toast.LENGTH_LONG).show();
}
// Trying to use the synchronous calls. Problems: mGoogleApiClient read/store from different threads.
this.removeProgressFragment();
this.addButtonsFragment();
// No geocoder is present. Issue an error message.
- // TODO: string resource
- Toast.makeText(this, "Cannot get address. No geocoder available.", Toast.LENGTH_LONG).show();
+ Toast.makeText(this, this.getString(R.string.weather_map_no_geocoder_available), Toast.LENGTH_LONG).show();
// Default values
final String city = this.getString(R.string.city_not_found);
weatherLocation.getLatitude(), weatherLocation.getLongitude());
final String urlWithoutCache = url.concat("&time=" + System.currentTimeMillis());
final String jsonData = HTTPClient.retrieveDataAsString(new URL(urlWithoutCache));
- final Current current = weatherService.retrieveCurrentFromJPOS(jsonData);
- // TODO: what is this for? I guess I could skip it :/
- final Calendar now = Calendar.getInstance();
- current.setDate(now.getTime());
-
- return current;
+
+ return weatherService.retrieveCurrentFromJPOS(jsonData);
}
private interface UnitsConversor {
import android.app.ActionBar;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+
import de.example.exampletdd.model.DatabaseQueries;
import de.example.exampletdd.model.WeatherLocation;
final WeatherLocation weatherLocation = query.queryDataBase();
if (weatherLocation != null) {
final ActionBar actionBar = this.getActionBar();
- // TODO: I18N and comma :/
- actionBar.setTitle(weatherLocation.getCity() + "," + weatherLocation.getCountry());
+ final String[] array = new String[2];
+ array[0] = weatherLocation.getCity();
+ array[1] = weatherLocation.getCountry();
+ final MessageFormat message = new MessageFormat("{0},{1}", Locale.US);
+ final String cityCountry = message.format(array);
+ actionBar.setTitle(cityCountry);
}
}
}
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.MenuItem;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+
import de.example.exampletdd.fragment.current.CurrentFragment;
import de.example.exampletdd.fragment.overview.OverviewFragment;
import de.example.exampletdd.model.DatabaseQueries;
final DatabaseQueries query = new DatabaseQueries(this.getApplicationContext());
final WeatherLocation weatherLocation = query.queryDataBase();
if (weatherLocation != null) {
- // TODO: I18N and comma :/
- actionBar.setTitle(weatherLocation.getCity() + "," + weatherLocation.getCountry());
+ final String[] array = new String[2];
+ array[0] = weatherLocation.getCity();
+ array[1] = weatherLocation.getCountry();
+ final MessageFormat message = new MessageFormat("{0},{1}", Locale.US);
+ final String cityCountry = message.format(array);
+ actionBar.setTitle(cityCountry);
} else {
- // TODO: static resource
- actionBar.setTitle("no chosen location");
+ actionBar.setTitle(this.getString(R.string.text_field_no_chosen_location));
}
// 2. Update forecast tab text.
@Override
public Fragment getItem(final int position) {
if (position == 0) {
- // TODO: new instance every time I click on tab?
return new CurrentFragment();
} else {
- // TODO: new instance every time I click on tab?
- final Fragment fragment = new OverviewFragment();
- return fragment;
+ return new OverviewFragment();
}
}
weatherLocation.getLatitude(), weatherLocation.getLongitude());
final String urlWithoutCache = url.concat("&time=" + System.currentTimeMillis());
final String jsonData = HTTPClient.retrieveDataAsString(new URL(urlWithoutCache));
- final Current current = weatherService.retrieveCurrentFromJPOS(jsonData);
- // TODO: what is this for? I guess I could skip it :/
- final Calendar now = Calendar.getInstance();
- current.setDate(now.getTime());
- return current;
+ return weatherService.retrieveCurrentFromJPOS(jsonData);
}
private interface UnitsConversor {
if (!isCountry) {
remoteView.setViewVisibility(R.id.weather_appwidget_country, View.GONE);
} else {
- // TODO: It is as if Android has a view cache. If I did not set VISIBLE value,
+ // TODO: It is as if Android had a view cache. If I did not set VISIBLE value,
// the country field would be gone forever... :/
remoteView.setViewVisibility(R.id.weather_appwidget_country, View.VISIBLE);
remoteView.setTextViewText(R.id.weather_appwidget_country, country);
// Restore UI state
final Current current = (Current) savedInstanceState.getSerializable("Current");
- // TODO: Could it be better to store in global forecast data even if it is null value?
- // So, perhaps do not check for null value and always store in global variable.
if (current != null) {
final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext());
store.saveCurrent(current);
final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext());
final Current current = store.getCurrent();
- // TODO: Could it be better to save current data even if it is null value?
- // So, perhaps do not check for null value.
if (current != null) {
savedInstanceState.putSerializable("Current", current);
}
R.drawable.weather_severe_alert);
}
- String description = this.getString(R.string.test_field_description_when_error);
+ String description = this.getString(R.string.text_field_description_when_error);
if (current.getWeather().size() > 0) {
description = current.getWeather().get(0).getDescription();
}
@Override
protected void onPostExecute(final WeatherLocation weatherLocation) {
- // TODO: Is AsyncTask calling this method even when RunTimeException in doInBackground method?
- // I hope so, otherwise I must catch(Throwable) in doInBackground method :(
// Call updateUI on the UI thread.
if (mCallbacks != null) {
// Restore UI state
final Forecast forecast = (Forecast) savedInstanceState.getSerializable("Forecast");
- // TODO: Could it be better to store in global forecast data even if it is null value?
- // So, perhaps do not check for null value and always store in global variable.
if (forecast != null) {
final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext());
store.saveForecast(forecast);
final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext());
final Forecast forecast = store.getForecast();
- // TODO: store forecast data in permanent storage and check here if there is data in permanent storage
if (forecast != null && this.isDataFresh(weatherLocation.getLastForecastUIUpdate())) {
this.updateUI(forecast);
} else {
final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext());
final Forecast forecast = store.getForecast();
- // TODO: Could it be better to save forecast data even if it is null value?
- // So, perhaps do not check for null value.
if (forecast != null) {
savedInstanceState.putSerializable("Forecast", forecast);
}
// Restore UI state
final Forecast forecast = (Forecast) savedInstanceState.getSerializable("Forecast");
- // TODO: Could it be better to store in global data forecast even if it is null value?
- // So, perhaps do not check for null value and always store in global variable.
if (forecast != null) {
final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext());
store.saveForecast(forecast);
final PermanentStorage store = new PermanentStorage(this.getActivity().getApplicationContext());
final Forecast forecast = store.getForecast();
- // TODO: Could it be better to save forecast data even if it is null value?
- // So, perhaps do not check for null value.
if (forecast != null) {
savedInstanceState.putSerializable("Forecast", forecast);
}
R.drawable.weather_severe_alert);
}
- String description = this.getString(R.string.test_field_description_when_error);
+ String description = this.getString(R.string.text_field_description_when_error);
if (forecast.getWeather().size() > 0) {
description = forecast.getWeather().get(0).getDescription();
}
import de.example.exampletdd.model.forecastweather.Forecast;
-/**
- * TODO: show some error message when there is no enough space for saving files. :/
- *
- */
public class PermanentStorage {
private static final String TAG = "PermanentStorage";
private static final String CURRENT_DATA_FILE = "current.file";
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <!-- TODO: align start/end humidity-rain wind-clouds -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
- <!-- TODO: align start/end humidity-rain wind-clouds -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center">
- <!-- TODO: align start/end feels like-snow humidity-rain wind-clouds -->
<LinearLayout android:id="@+id/weather_current_data_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<string name="text_units_mm3h">mm 3h</string>
<string name="text_units_percent">%</string>
<string name="text_field_remote_error">No data available</string>
- <string name="test_field_description_when_error">no description available</string>
+ <string name="text_field_description_when_error">no description available</string>
+ <string name="text_field_no_chosen_location">no chosen location</string>
<!-- Preferences Acitivity -->
<string name="weather_preferences_action_settings">Settings</string>
<string name="weather_map_button_savelocation">Save Location</string>
<string name="weather_map_button_getlocation">Get Location</string>
<string name="weather_map_not_enabled_location">You do not have enabled location.</string>
+ <string name="weather_map_no_geocoder_available">Cannot get address. No geocoder available.</string>
+ <string name="weather_map_mark_location">Mark your location</string>
<!-- About Activity -->
<string name="weather_about_action">About</string>