diff --git a/app/src/main/java/de/apps4ics/mountainnavigation/handlers/WeatherHandler.java b/app/src/main/java/de/apps4ics/mountainnavigation/handlers/WeatherHandler.java index 32ee7ec..1837cba 100644 --- a/app/src/main/java/de/apps4ics/mountainnavigation/handlers/WeatherHandler.java +++ b/app/src/main/java/de/apps4ics/mountainnavigation/handlers/WeatherHandler.java @@ -126,25 +126,21 @@ } } - public void getCurrentWeather() { - getCurrentWeather(0); - } - /** * * @param offset number of days (in the past) to search for result in the cache, only for getCurrentWeatherCached */ - public MyWeather getCurrentWeather(int offset) { - if(MainActivity.hasInternet()) return getCurrentWeatherOnline(); - else return getCurrentWeatherCached(offset); + public MyWeather getCurrentWeather(double lat, double lon, int offset) { + if(MainActivity.hasInternet()) return getCurrentWeatherOnline(lat, lon); + else return getCurrentWeatherCached(lat, lon, offset); } - private MyWeather getCurrentWeatherOnline() { + private MyWeather getCurrentWeatherOnline(double lat, double lon) { //return new MyWeather(); return null; } - private MyWeather getCurrentWeatherCached(int offset) { + private MyWeather getCurrentWeatherCached(double lat, double lon, int offset) { //return new MyWeather(); return null; } @@ -195,15 +191,19 @@ }); } - public MyWeather getForecastOnline(long start, long end, int step) { + public MyWeather getForecastOnline(double lat, double lon, int days, int step) { return new MyWeather(new WeatherForecast()); } - public MyWeather getForecastCached(long start, long end, int step, int offset) { + public MyWeather getForecastCached(double lat, double lon, int days, int step, int offset) { return new MyWeather(new WeatherForecast()); } public MyWeather getHistoricalWeather(float lat, float lon, long start, long end){ + return getHistoricalWeather(lat, lon, start, end, 3); + } + + public MyWeather getHistoricalWeather(float lat, float lon, long start, long end, int step){ Date startDate = new Date(start / 1000); //OWM uses seconds instead of milliseconds Date endDate = new Date(end / 1000); histWeather = null; @@ -229,8 +229,8 @@ return new MyWeather(histWeather); } - private void convertWeatherLibWeather(Weather weather) { - + private void insertIntoDatabase(Weather weather) { + insertIntoDatabase(new MyWeather(weather)); } private void insertIntoDatabase(MyWeather weather) {