mathisdt / trackworktime

Android app to track your work time via WiFi or location and categorize each recorded intervall by a predefined client/task and a free text.

Home Page:https://zephyrsoft.org/trackworktime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

select workplace using a map

mathisdt opened this issue · comments

Currently the user has to use either the menu item "Here = Work" or type in latitude and longitude of their workplace. At least the manual setting should be replaced by selecting a location on a map.

Here the german magazine c't described how it can be done using OSM (behind a paypall). In short, we could start with this:

  • add implementation 'org.osmdroid:osmdroid-android:6.1.14' to build.gradle
  • initialize the map module with Configuration.getInstance().load(context, PreferenceManager.getDefaultSharedPreferences(context));
  • include MapView into layout (probably a custom setting editor would be best)
GeoPoint point = new GeoPoint(
 52.3859132, 9.8089183); // heise
IMapController mapController =
 mapView.getController();
mapController.setCenter(point);
mapController.setZoom(12.0);
MyLocationNewOverlay myLocation =
 new MyLocationNewOverlay(
  new GpsMyLocationProvider(context),
  mapView);
mapView.getOverlays().add(myLocation);
Bitmap meBitmap = (
 (BitmapDrawable)getDrawable(
  R.drawable.me)).getBitmap();
myLocation.setPersonIcon(meBitmap);