diff --git a/app/src/main/java/de/apps4ics/mountainnavigation/MyWeather.java b/app/src/main/java/de/apps4ics/mountainnavigation/MyWeather.java new file mode 100644 index 0000000..bd126c1 --- /dev/null +++ b/app/src/main/java/de/apps4ics/mountainnavigation/MyWeather.java @@ -0,0 +1,7 @@ +package de.apps4ics.mountainnavigation; + +/** + * Created by Vinz on 07.03.2016. + */ +public class MyWeather { +} diff --git a/app/src/main/java/de/apps4ics/mountainnavigation/PoiHandler.java b/app/src/main/java/de/apps4ics/mountainnavigation/PoiHandler.java new file mode 100644 index 0000000..cf7a361 --- /dev/null +++ b/app/src/main/java/de/apps4ics/mountainnavigation/PoiHandler.java @@ -0,0 +1,62 @@ +package de.apps4ics.mountainnavigation; + +import de.apps4ics.mountainnavigation.pois.Options; + +/** + * Created by Vinz on 06.03.2016. + */ +public class PoiHandler { + public void getPoisAround(double lat, double lon) { + getPoisAround(lat, lon, -1); + } + + public void getPoisAround(double lat, double lon, int limit) { + + } + + private void getPoisAroundOnline(double lat, double lon, int limit) { + + } + + private void getPoisAroundCached(double lat, double lon, int limit) { + + } + + public void getPoisAlong(double lat, double lon) { + getPoisAlong(lat, lon, -1); + } + + public void getPoisAlong(double lat, double lon, int limit) { + + } + + private void getPoisAlongOnline(double lat, double lon, int limit) { + + } + + private void getPoisAlongCached(double lat, double lon, int limit) { + + } + + //TODO move addPoiDialog and stuff to this class + + private void addPoiToOsm(double lat, double lon, double alt, int type, Options[] options) { + + } + + private void addPoiToCache(double lat, double lon, double alt, int type, Options[] options) { + //TODO register callback to upload it to OSM as soon as data/wifi is available + } + + public void editPoi(int id, Options[] options) { + + } + + private void editPoiToOsm(int id, Options[] options) { + + } + + private void editPoiToCache(int id, Options[] options) { + + } +} diff --git a/app/src/main/java/de/apps4ics/mountainnavigation/WeatherDatabase.java b/app/src/main/java/de/apps4ics/mountainnavigation/WeatherDatabase.java new file mode 100644 index 0000000..6609352 --- /dev/null +++ b/app/src/main/java/de/apps4ics/mountainnavigation/WeatherDatabase.java @@ -0,0 +1,92 @@ +package de.apps4ics.mountainnavigation; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +/** + * Created by Vinz on 06.03.2016. + */ +public class WeatherDatabase extends SQLiteOpenHelper { + private static final int DATABASE_VERSION = 1; + private static final String DATABASE_NAME = "weathers.db"; + private static final String TABLE_WEATHER = "weather"; + private static final String TABLE_LOCATION = "locations"; + private static final String TABLE_WIND = "winds"; + + private static final String KEY_ID = "_id"; + private static final String KEY_TIMESTAMP = "_timestamp"; + private static final String KEY_TEMP_MIN = "_temp_min"; + private static final String KEY_TEMP_MAX = "_temp_max"; + private static final String KEY_LOCATION_ID = "_loc_id"; + private static final String KEY_SUNRISE = "_sunrise"; + private static final String KEY_SUNSET = "_sunset"; + private static final String KEY_WEATHER_ID = "_weather_id"; + private static final String KEY_WEATHER_CODE = "_weather_code"; + private static final String KEY_PRESSURE = "_pressure"; + private static final String KEY_HUMIDITY = "_humidity"; + private static final String KEY_MAIN = "_main"; + private static final String KEY_DESC = "_desc"; + private static final String KEY_WIND_ID = "_wind_id"; + private static final String KEY_RAIN = "_rain"; //Rain volume for the last 3 hours + private static final String KEY_SNOW = "_snow"; //Snow volume for the last 3 hours + private static final String KEY_CLOUDS = "_clouds"; //cloudiness in % + + private static final String KEY_LAT = "_lat"; + private static final String KEY_LON = "_lon"; + private static final String KEY_ALT = "_alt"; + private static final String KEY_NAME = "_name"; + private static final String KEY_COUNTRY = "_country"; + + private static final String KEY_SPEED = "_speed"; + private static final String KEY_DIR = "_dir"; + + public WeatherDatabase(Context context){ + super(context, DATABASE_NAME, null, DATABASE_VERSION); + } + + @Override + public void onCreate(SQLiteDatabase db) { + String CREATE_WEATHER_TABLE = "CREATE TABLE " + TABLE_WEATHER + "(" + + KEY_ID + " INTEGER PRIMARY KEY," + + KEY_TIMESTAMP + " INTEGER," + + KEY_TEMP_MIN + " REAL," + + KEY_TEMP_MAX + " REAL," + + KEY_LOCATION_ID + " INTEGER," + + KEY_SUNRISE + " INTEGER," + + KEY_SUNSET + " INTEGER," + + KEY_WEATHER_ID + " INTEGER," + + KEY_WEATHER_CODE + " INTEGER," + + KEY_PRESSURE + " REAL," + + KEY_HUMIDITY + " REAL," + + KEY_MAIN + " TEXT," + + KEY_DESC + " TEXT," + + KEY_WIND_ID + " INTEGER," + + KEY_RAIN + " REAL," + + KEY_SNOW + " REAL," + + KEY_CLOUDS + " INTEGER" + ")"; + db.execSQL(CREATE_WEATHER_TABLE); + String CREATE_LOCATION_TABLE = "CREATE TABLE " + TABLE_LOCATION + "(" + + KEY_ID + " INTEGER PRIMARY KEY," + + KEY_LAT + " REAL," + + KEY_LON + " REAL," + + KEY_ALT + " REAL," + + KEY_NAME + " TEXT," + + KEY_COUNTRY + " TEXT" + ")"; + db.execSQL(CREATE_LOCATION_TABLE); + String CREATE_WIND_TABLE = "CREATE TABLE " + TABLE_WIND + "(" + + KEY_ID + " INTEGER PRIMARY KEY," + + KEY_SPEED + " REAL," + + KEY_DIR + " REAL" + ")"; + db.execSQL(CREATE_WIND_TABLE); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + //TODO? + } + + public int insertWeather(MyWeather weather) { + return 0; + } +} diff --git a/app/src/main/java/de/apps4ics/mountainnavigation/WeatherHandler.java b/app/src/main/java/de/apps4ics/mountainnavigation/WeatherHandler.java new file mode 100644 index 0000000..dcd87ab --- /dev/null +++ b/app/src/main/java/de/apps4ics/mountainnavigation/WeatherHandler.java @@ -0,0 +1,61 @@ +package de.apps4ics.mountainnavigation; + +import android.content.Context; + +import com.survivingwithandroid.weather.lib.model.Weather; + +/** + * Created by Vinz on 06.03.2016. + */ +public class WeatherHandler { + private Context context; + private WeatherDatabase weatherDb; + + public WeatherHandler(Context context) { + weatherDb = new WeatherDatabase(context); + } + + public void getCurrentWeather() { + getCurrentWeather(0); + } + + /** + * + * @param offset number of days (in the past) to search for result in the cache, only for getCurrentWeatherCached + */ + public void getCurrentWeather(int offset) { + + } + + private void getCurrentWeatherOnline() { + + } + + private void getCurrentWeatherCached(int offset) { + + } + + public void getForecast(long start, long end, int step) { + getForecast(start, end, step, 0); + } + + public void getForecast(long start, long end, int step, int offset) { + + } + + public void getForecastOnline(long start, long end, int step) { + + } + + public void getForecastCached(long start, long end, int step, int offset) { + + } + + private void convertWeatherLibWeather(Weather weather) { + + } + + private void insertIntoDatabase(MyWeather weather) { + weatherDb.insertWeather(weather); + } +} diff --git a/app/src/main/java/de/apps4ics/mountainnavigation/pois/Options.java b/app/src/main/java/de/apps4ics/mountainnavigation/pois/Options.java new file mode 100644 index 0000000..33e091b --- /dev/null +++ b/app/src/main/java/de/apps4ics/mountainnavigation/pois/Options.java @@ -0,0 +1,7 @@ +package de.apps4ics.mountainnavigation.pois; + +/** + * Created by Vinz on 06.03.2016. + */ +public class Options { +}