this.mLocationManager.requestSingleUpdate(criteria, this, null);
} else {
// TODO: string resource
- Toast.makeText(this, "You do not have enabled location.", Toast.LENGTH_LONG).show();
+ 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.
// new GetLocationTask(this).execute();
}
@Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- // TODO Auto-generated method stub
-
- }
+ public void onStatusChanged(String provider, int status, Bundle extras) {}
@Override
- public void onProviderEnabled(String provider) {
- // TODO Auto-generated method stub
-
- }
+ public void onProviderEnabled(String provider) {}
@Override
- public void onProviderDisabled(String provider) {
- // TODO Auto-generated method stub
-
- }
+ public void onProviderDisabled(String provider) {}
}
+++ /dev/null
-package de.example.exampletdd.dummy;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Helper class for providing sample content for user interfaces created by
- * Android template wizards.
- * <p>
- * TODO: Replace all uses of this class before publishing your app.
- */
-public class DummyContent {
-
- /**
- * An array of sample (dummy) items.
- */
- public static List<DummyItem> ITEMS = new ArrayList<DummyItem>();
-
- /**
- * A map of sample (dummy) items, by ID.
- */
- public static Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>();
-
- static {
- // Add 3 sample items.
- addItem(new DummyItem("1", "Item 1"));
- addItem(new DummyItem("2", "Item 2"));
- addItem(new DummyItem("3", "Item 3"));
- }
-
- private static void addItem(DummyItem item) {
- ITEMS.add(item);
- ITEM_MAP.put(item.id, item);
- }
-
- /**
- * A dummy item representing a piece of content.
- */
- public static class DummyItem {
- public String id;
- public String content;
-
- public DummyItem(String id, String content) {
- this.id = id;
- this.content = content;
- }
-
- @Override
- public String toString() {
- return content;
- }
- }
-}
new ServiceParser(new JPOSWeatherParser()));
task.execute(weatherLocation.getLatitude(), weatherLocation.getLongitude());
- // TODO: make sure UI thread keeps running in parallel after that. I guess.
}
}
R.drawable.weather_severe_alert);
}
- // TODO: static resource
- String description = "no description available";
+ String description = this.getString(R.string.test_field_description_when_error);
if (current.getWeather().size() > 0) {
description = current.getWeather().get(0).getDescription();
}
- // TODO: units!!!!
String humidityValue = "";
if ((current.getMain() != null)
&& (current.getMain().getHumidity() != null)) {
return false;
}
-
- // TODO: How could I show just one progress dialog when I have two fragments in tabs
- // activity doing the same in background?
- // I mean, if OverviewTask shows one progress dialog and CurrentTask does the same I will have
- // have two progress dialogs... How may I solve this problem? I HATE ANDROID.
+
private class CurrentTask extends AsyncTask<Object, Void, Current> {
// Store the context passed to the AsyncTask when the system instantiates it.
private final Context localContext;
final String url = weatherService.createURIAPICurrent(urlAPI, APIVersion, latitude, longitude);
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);
}
@Override
protected void onPostExecute(final Current current) {
- // 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.
final Intent currentData = new Intent("de.example.exampletdd.UPDATECURRENT");
new ServiceParser(new JPOSWeatherParser()));
task.execute(weatherLocation.getLatitude(), weatherLocation.getLongitude());
- // TODO: make sure thread UI keeps running in parallel after that. I guess.
}
}
return false;
}
- // TODO: How could I show just one progress dialog when I have two fragments in tabs
- // activity doing the same in background?
- // I mean, if OverviewTask shows one progress dialog and CurrentTask does the same I will have
- // have two progress dialogs... How may I solve this problem? I HATE ANDROID.
private class OverviewTask extends AsyncTask<Object, Void, Forecast> {
// Store the context passed to the AsyncTask when the system instantiates it.
private final Context localContext;
@Override
protected void onPostExecute(final Forecast forecast) {
- // 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.
final Intent forecastData = new Intent("de.example.exampletdd.UPDATEFORECAST");
} else {
picture = BitmapFactory.decodeResource(this.getResources(),
R.drawable.weather_severe_alert);
- }
+ }
- // TODO: string resource
- String description = "no description available";
+ String description = this.getString(R.string.test_field_description_when_error);
if (forecast.getWeather().size() > 0) {
description = forecast.getWeather().get(0).getDescription();
}
- // TODO: units!!!!
String humidityValue = "";
if (forecast.getHumidity() != null) {
final double conversion = (Double) forecast.getHumidity();
if (forecast != null) {
this.updateUI(forecast, this.mChosenDay);
}
-
- // TODO: Overview is doing things with mListState... Why not here?
}
}
private WeatherLocation queryDataBase(final String table,
final String[] projection, final String[] selectionArgs,
final String selection, final DoQuery doQuery) {
- // TODO: execute around idiom? I miss try/finally with resources
final SQLiteDatabase db = this.mDbHelper.getReadableDatabase();
try {
final Cursor cursor = db.query(table, projection, selection, selectionArgs, null, null, null);
<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>
<!-- Preferences Acitivity -->
<string name="weather_preferences_action_settings">Settings</string>
<string name="progress_dialog_generic_message">Please wait…</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>
<!-- About Activity -->
<string name="weather_about_action">About</string>
<string name="my_url">http://gumartinm.name</string>
<string name="openweahtermap_url">http://openweathermap.org/</string>
<string name="title_activity_about">About</string>
- <string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
</resources>