diff --git a/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java b/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java index cc670bc..3693220 100644 --- a/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java +++ b/app/src/main/java/de/apps4ics/mountainnavigation/MainActivity.java @@ -75,6 +75,7 @@ private CharSequence mDrawerTitle; private static final int GPS_MIN_TIME = 5000; private static final int GPS_MIN_DIST = 5; + private static final String API_KEY = "fd4034defae557fd5f2fdaaf73c3402c"; private static SimpleDateFormat df_hm; private static SimpleDateFormat df_full; @@ -180,7 +181,7 @@ WeatherClient.ClientBuilder weatherBuilder = new WeatherClient.ClientBuilder(); WeatherConfig weatherConfig = new WeatherConfig(); weatherConfig.unitSystem = WeatherConfig.UNIT_SYSTEM.M; - weatherConfig.ApiKey = "fd4034defae557fd5f2fdaaf73c3402c"; + weatherConfig.ApiKey = API_KEY; weatherClient = null; try { @@ -416,22 +417,21 @@ public void onWeatherRetrieved(CurrentWeather weather) { Log.d(TAG, "City [" + weather.weather.location.getCity() + "] Current temp: " + weather.weather.temperature.getTemp()); - /* String title = String.format("Weather for %s in %s", weather.weather.location.getCity(), weather.weather.location.getCountry()); - String msg = String.format("%f%s (%f%s/%f%s)\nSunrise: %s\nSunset: %s\nRegion: %s\nPopulation: %d", + String msg = String.format("%1$f%2$s (%3$f%4$s/%5$f%6$s)\nSunrise: %7$s\nSunset: %8$s\nRegion: %9$s\nPopulation: %10$d", weather.weather.temperature.getTemp(), weather.getUnit().tempUnit, weather.weather.temperature.getMinTemp(), weather.getUnit().tempUnit, weather.weather.temperature.getMaxTemp(), weather.getUnit().tempUnit, - df_hm.format(new Date(weather.weather.location.getSunrise())), - df_hm.format(new Date(weather.weather.location.getSunset())), + df_hm.format(new Date(weather.weather.location.getSunrise() * 1000)), + df_hm.format(new Date(weather.weather.location.getSunset() * 1000)), weather.weather.location.getRegion(), weather.weather.location.getPopulation()); InformDialog informWeatherDialog = new InformDialog(title, msg); - informWeatherDialog.show(getFragmentManager(), "Inform Dialog");*/ + informWeatherDialog.show(getFragmentManager(), "Inform Dialog"); } @Override