app icon shading changed, notification taps now preserve state, clean up

master
y20k 2016-09-09 22:28:12 +02:00
parent 5a9520a105
commit 4859536b3a
18 changed files with 129 additions and 103 deletions

View File

@ -1,14 +1,14 @@
README README
====== ======
Trackbook - Movement recorder for Android Trackbook - Movement Recorder for Android
----------------------------------------- -----------------------------------------
**Version 0.1.x ("The Great Gig in the Sky")** **Version 0.1.x ("The Great Gig in the Sky")**
Trackbook is a bare bones app for recording your movements. Trackbook is great for hiking, vacation or workout. Once started it displays your movements on a map. Trackbook is a bare bones app for recording your movements. Trackbook is great for hiking, vacation or workout. Once started it displays your movements on a map.
Trackbook is free software. It is published under the [MIT open source license](https://opensource.org/licenses/MIT). Trackbook uses [osmdroid](https://github.com/osmdroid/osmdroid) to display the map. osmdroid is also free software. It is published under the [Apache License](https://github.com/osmdroid/osmdroid/blob/master/LICENSE). Want to help? Please check out the notes in [CONTRIBUTE.md](https://github.com/y20k/transistor/blob/master/CONTRIBUTE.md) first. Trackbook is free software. It is published under the [MIT open source license](https://opensource.org/licenses/MIT). Trackbook uses [osmdroid](https://github.com/osmdroid/osmdroid) to display the map, which is also free software published under the [Apache License](https://github.com/osmdroid/osmdroid/blob/master/LICENSE). Want to help? Please check out the notes in [CONTRIBUTE.md](https://github.com/y20k/transistor/blob/master/CONTRIBUTE.md) first.
Install Trackbook Install Trackbook
------------------ ------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -144,13 +144,12 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
super.onResume(); super.onResume();
Intent intent = getIntent(); Intent intent = getIntent();
if (intent.hasExtra(EXTRA_TRACKING_STATE)) { String intentAction = intent.getAction();
if (intentAction != null && intentAction.contains(ACTION_SHOW_MAP) && intent.hasExtra(EXTRA_TRACKING_STATE)) {
mTrackerServiceRunning = intent.getBooleanExtra(EXTRA_TRACKING_STATE, false); mTrackerServiceRunning = intent.getBooleanExtra(EXTRA_TRACKING_STATE, false);
mMainActivityFragment.setTrackingState(mTrackerServiceRunning); mMainActivityFragment.setTrackingState(mTrackerServiceRunning);
} // prevent multiple reactions to intent
intent.setAction(ACTION_DEFAULT);
if (intent.hasExtra(EXTRA_CLEAR_MAP)) {
clearMap();
} }
// if not in onboarding mode: set state of FloatingActionButton // if not in onboarding mode: set state of FloatingActionButton

View File

@ -26,6 +26,7 @@ import android.location.Location;
import android.location.LocationListener; import android.location.LocationListener;
import android.location.LocationManager; import android.location.LocationManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.content.LocalBroadcastManager; import android.support.v4.content.LocalBroadcastManager;
@ -256,7 +257,6 @@ public class MainActivityFragment extends Fragment implements TrackbookKeys {
// CASE MY LOCATION // CASE MY LOCATION
case R.id.action_bar_my_location: case R.id.action_bar_my_location:
Toast.makeText(mActivity, mActivity.getString(R.string.toast_message_my_location), Toast.LENGTH_LONG).show();
if (mLocationManager.getProviders(true).size() == 0) { if (mLocationManager.getProviders(true).size() == 0) {
// location services are off - ask user to turn them on // location services are off - ask user to turn them on
@ -280,6 +280,16 @@ public class MainActivityFragment extends Fragment implements TrackbookKeys {
// mark user's new location on map and remove last marker // mark user's new location on map and remove last marker
updateMyLocationMarker(); updateMyLocationMarker();
// inform user about location quality
String locationInfo;
long locationAge = (SystemClock.elapsedRealtimeNanos() - mCurrentBestLocation.getElapsedRealtimeNanos()) / 1000000;
String locationAgeString = LocationHelper.convertToReadableTime(locationAge, false);
if (locationAgeString == null) {
locationAgeString = mActivity.getString(R.string.toast_message_last_location_age_one_hour);
}
locationInfo = " " + locationAgeString + " | " + mCurrentBestLocation.getProvider();
Toast.makeText(mActivity, mActivity.getString(R.string.toast_message_last_location) + locationInfo, Toast.LENGTH_LONG).show();
return true; return true;
// CASE DEFAULT // CASE DEFAULT
@ -307,10 +317,9 @@ public class MainActivityFragment extends Fragment implements TrackbookKeys {
public void setTrackingState (boolean trackingState) { public void setTrackingState (boolean trackingState) {
mTrackerServiceRunning = trackingState; mTrackerServiceRunning = trackingState;
// got a new track (from notification)= // got a new track (from notification)
Intent intent = mActivity.getIntent(); Intent intent = mActivity.getIntent();
if (intent.hasExtra(EXTRA_TRACK)) { if (intent != null && intent.hasExtra(EXTRA_TRACK)) {
LogHelper.v(LOG_TAG, "ding !!!");
mTrack = intent.getParcelableExtra(EXTRA_TRACK); mTrack = intent.getParcelableExtra(EXTRA_TRACK);
} }
@ -425,7 +434,6 @@ public class MainActivityFragment extends Fragment implements TrackbookKeys {
// draw track on map // draw track on map
mTrack = intent.getParcelableExtra(EXTRA_TRACK); mTrack = intent.getParcelableExtra(EXTRA_TRACK);
drawTrackOverlay(mTrack); drawTrackOverlay(mTrack);
Toast.makeText(mActivity, "New WayPoint.", Toast.LENGTH_LONG).show(); // TODO Remove
// center map over last location // center map over last location
mCurrentBestLocation = intent.getParcelableExtra(EXTRA_LAST_LOCATION); mCurrentBestLocation = intent.getParcelableExtra(EXTRA_LAST_LOCATION);
mController.setCenter(convertToGeoPoint(mCurrentBestLocation)); mController.setCenter(convertToGeoPoint(mCurrentBestLocation));

View File

@ -148,7 +148,7 @@ public class TrackerService extends Service implements TrackbookKeys {
/* Adds a new WayPoint to current track */ /* Adds a new WayPoint to current track */
public void addWayPointToTrack() { private void addWayPointToTrack() {
// create new WayPoint // create new WayPoint
WayPoint newWayPoint = null; WayPoint newWayPoint = null;
@ -159,14 +159,12 @@ public class TrackerService extends Service implements TrackbookKeys {
if (trackSize == 0) { if (trackSize == 0) {
// add first location to track // add first location to track
newWayPoint = mTrack.addWayPoint(mCurrentBestLocation); newWayPoint = mTrack.addWayPoint(mCurrentBestLocation);
LogHelper.v(LOG_TAG, "mTrack.addWayPoint. Tracksize: " + trackSize); // TODO remove
} else { } else {
// get last waypoint and compare it to current location // get last waypoint and compare it to current location
Location lastWayPoint = mTrack.getWayPointLocation(trackSize - 1); Location lastWayPoint = mTrack.getWayPointLocation(trackSize - 1);
if (LocationHelper.isNewWayPoint(lastWayPoint, mCurrentBestLocation)) { if (LocationHelper.isNewWayPoint(lastWayPoint, mCurrentBestLocation)) {
// if new, add current best location to track // if new, add current best location to track
newWayPoint = mTrack.addWayPoint(mCurrentBestLocation); newWayPoint = mTrack.addWayPoint(mCurrentBestLocation);
LogHelper.v(LOG_TAG, "mTrack.addWayPoint. Tracksize: " + trackSize); // TODO remove
} }
} }
@ -191,7 +189,6 @@ public class TrackerService extends Service implements TrackbookKeys {
if (LocationHelper.isBetterLocation(location, mCurrentBestLocation)) { if (LocationHelper.isBetterLocation(location, mCurrentBestLocation)) {
// save location // save location
mCurrentBestLocation = location; mCurrentBestLocation = location;
// TODO hand over mCurrentBestLocation to fragment
} }
} }
@ -212,7 +209,6 @@ public class TrackerService extends Service implements TrackbookKeys {
/* Creates gps and network location listeners */ /* Creates gps and network location listeners */
private void startFindingLocation() { private void startFindingLocation() {
LogHelper.v(LOG_TAG, "startFindingLocation"); // TODO remove
// put up notification // put up notification
NotificationHelper.show(this,mTrack); NotificationHelper.show(this,mTrack);
@ -229,7 +225,6 @@ public class TrackerService extends Service implements TrackbookKeys {
/* Removes gps and network location listeners */ /* Removes gps and network location listeners */
private void stopFindingLocation() { private void stopFindingLocation() {
LogHelper.v(LOG_TAG, "stopFindingLocation"); // TODO remove
// remove listeners // remove listeners
LocationHelper.removeLocationListeners(mLocationManager, mGPSListener, mNetworkListener); LocationHelper.removeLocationListeners(mLocationManager, mGPSListener, mNetworkListener);

View File

@ -26,7 +26,6 @@ import org.y20k.trackbook.helpers.TrackbookKeys;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
/** /**
@ -39,7 +38,7 @@ public class Track implements TrackbookKeys, Parcelable {
/* Main class variables */ /* Main class variables */
private List<WayPoint> mWayPoints; private final List<WayPoint> mWayPoints;
private float mTrackLength; private float mTrackLength;
private long mTrackDuration; private long mTrackDuration;
@ -77,24 +76,26 @@ public class Track implements TrackbookKeys, Parcelable {
// add up distance // add up distance
mTrackLength = addDistanceToTrack(location); mTrackLength = addDistanceToTrack(location);
boolean stopOver;
int wayPointCount = mWayPoints.size(); int wayPointCount = mWayPoints.size();
if (wayPointCount == 0) {
stopOver = false; // determine if last waypoint was a stopover
} else { boolean stopOver = false;
if (wayPointCount > 1) {
Location lastLocation = mWayPoints.get(wayPointCount - 1).getLocation(); Location lastLocation = mWayPoints.get(wayPointCount - 1).getLocation();
stopOver = LocationHelper.isStopOver(lastLocation, location); stopOver = LocationHelper.isStopOver(lastLocation, location);
} }
if (stopOver) {
// mark last waypoint as stopover
LogHelper.v(LOG_TAG, "Last Location was a stop.");
mWayPoints.get(wayPointCount-1).setIsStopOver(true);
}
// create new waypoint // create new waypoint
WayPoint wayPoint = new WayPoint(location, stopOver, mTrackLength); WayPoint wayPoint = new WayPoint(location, false, mTrackLength);
// add new waypoint to track // add new waypoint to track
mWayPoints.add(wayPoint); mWayPoints.add(wayPoint);
// TODO remove log here
LogHelper.v(LOG_TAG, "Waypoint No. " + mWayPoints.indexOf(wayPoint) + " Location: " + wayPoint.getLocation().toString());
return wayPoint; return wayPoint;
} }
@ -119,7 +120,7 @@ public class Track implements TrackbookKeys, Parcelable {
/* Getter for duration of track */ /* Getter for duration of track */
public String getTrackDuration() { public String getTrackDuration() {
return convertToReadableTime(mTrackDuration); return LocationHelper.convertToReadableTime(mTrackDuration, true);
} }
@ -152,14 +153,6 @@ public class Track implements TrackbookKeys, Parcelable {
} }
/* Converts milliseconds to hh:mm:ss */
private String convertToReadableTime(long milliseconds) {
return String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(milliseconds),
TimeUnit.MILLISECONDS.toMinutes(milliseconds) % TimeUnit.HOURS.toMinutes(1),
TimeUnit.MILLISECONDS.toSeconds(milliseconds) % TimeUnit.MINUTES.toSeconds(1));
}
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;

View File

@ -22,6 +22,7 @@ import android.location.LocationManager;
import android.os.SystemClock; import android.os.SystemClock;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
/** /**
@ -94,10 +95,8 @@ public final class LocationHelper implements TrackbookKeys {
// if it's been more than two minutes since the current location, use the new location because the user has likely moved // if it's been more than two minutes since the current location, use the new location because the user has likely moved
if (isSignificantlyNewer) { if (isSignificantlyNewer) {
LogHelper.v(LOG_TAG, "Location isSignificantlyNewer: " + location.getProvider()); // TODO remove
return true; return true;
} else if (isSignificantlyOlder) { } else if (isSignificantlyOlder) {
LogHelper.v(LOG_TAG, "Location isSignificantlyOlder: " + location.getProvider()); // TODO remove
return false; return false;
} }
@ -127,8 +126,8 @@ public final class LocationHelper implements TrackbookKeys {
if (location == null) { if (location == null) {
return false; return false;
} else { } else {
long locationTime = SystemClock.elapsedRealtimeNanos() - location.getElapsedRealtimeNanos(); long locationAge = SystemClock.elapsedRealtimeNanos() - location.getElapsedRealtimeNanos();
return locationTime < TWO_MINUTES_IN_NANOSECONDS; return locationAge < TWO_MINUTES_IN_NANOSECONDS;
} }
} }
@ -213,6 +212,26 @@ public final class LocationHelper implements TrackbookKeys {
} }
/* Converts milliseconds to mm:ss or hh:mm:ss */
public static String convertToReadableTime(long milliseconds, boolean includeHours) {
if (includeHours) {
// format hh:mm:ss
return String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(milliseconds),
TimeUnit.MILLISECONDS.toMinutes(milliseconds) % TimeUnit.HOURS.toMinutes(1),
TimeUnit.MILLISECONDS.toSeconds(milliseconds) % TimeUnit.MINUTES.toSeconds(1));
} else if (TimeUnit.MILLISECONDS.toHours(milliseconds) < 1) {
// format mm:ss
return String.format("%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(milliseconds) % TimeUnit.HOURS.toMinutes(1),
TimeUnit.MILLISECONDS.toSeconds(milliseconds) % TimeUnit.MINUTES.toSeconds(1));
} else {
return null;
}
}
/* Checks whether two location providers are the same */ /* Checks whether two location providers are the same */
private static boolean isSameProvider(String provider1, String provider2) { private static boolean isSameProvider(String provider1, String provider2) {
// credit: the isSameProvider method was sample code from: https://developer.android.com/guide/topics/location/strategies.html // credit: the isSameProvider method was sample code from: https://developer.android.com/guide/topics/location/strategies.html

View File

@ -20,7 +20,6 @@ import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.location.Location; import android.location.Location;
import android.support.v7.widget.AppCompatDrawableManager; import android.support.v7.widget.AppCompatDrawableManager;
import android.text.format.DateFormat;
import android.widget.Toast; import android.widget.Toast;
import org.osmdroid.util.GeoPoint; import org.osmdroid.util.GeoPoint;
@ -44,7 +43,7 @@ public final class MapHelper {
/* Creates icon overlay for current position (used in MainActivity Fragment) */ /* Creates icon overlay for current position (used in MainActivity Fragment) */
public static ItemizedIconOverlay createMyLocationOverlay(Context context, Location currentBestLocation, boolean locationIsNew) { public static ItemizedIconOverlay createMyLocationOverlay(final Context context, Location currentBestLocation, boolean locationIsNew) {
final ArrayList<OverlayItem> overlayItems = new ArrayList<>(); final ArrayList<OverlayItem> overlayItems = new ArrayList<>();
@ -56,7 +55,7 @@ public final class MapHelper {
newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_dot_grey_24dp); newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_dot_grey_24dp);
} }
final GeoPoint position = new GeoPoint(currentBestLocation.getLatitude(), currentBestLocation.getLongitude()); final GeoPoint position = new GeoPoint(currentBestLocation.getLatitude(), currentBestLocation.getLongitude());
OverlayItem overlayItem = new OverlayItem(context.getString(R.string.marker_my_location_title), context.getString(R.string.marker_my_location_description), position); OverlayItem overlayItem = createOverlayItem(context, currentBestLocation);
overlayItem.setMarker(newMarker); overlayItem.setMarker(newMarker);
// add marker to list of overlay items // add marker to list of overlay items
@ -67,6 +66,7 @@ public final class MapHelper {
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() { new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override @Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) { public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
Toast.makeText(context, item.getTitle() + " | " + item.getSnippet(), Toast.LENGTH_LONG).show();
LogHelper.v(LOG_TAG, "Tap on the My Location dot icon detected."); LogHelper.v(LOG_TAG, "Tap on the My Location dot icon detected.");
return true; return true;
} }
@ -136,10 +136,8 @@ public final class MapHelper {
newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_crumb_blue_24dp); newMarker = AppCompatDrawableManager.get().getDrawable(context, R.drawable.ic_my_location_crumb_blue_24dp);
} }
final String title = Float.toString(wayPoint.getDistanceToStartingPoint()) + " (" + wayPoint.getLocation().getProvider() + ")"; // create overlay item
final String description = DateFormat.getDateFormat(context).format(wayPoint.getLocation().getTime()); OverlayItem overlayItem = createOverlayItem(context, wayPoint.getLocation());
final GeoPoint position = new GeoPoint(wayPoint.getLocation().getLatitude(), wayPoint.getLocation().getLongitude());
OverlayItem overlayItem = new OverlayItem(title, description, position);
overlayItem.setMarker(newMarker); overlayItem.setMarker(newMarker);
// add marker to list of overlay items // add marker to list of overlay items
@ -151,7 +149,7 @@ public final class MapHelper {
new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() { new ItemizedIconOverlay.OnItemGestureListener<OverlayItem>() {
@Override @Override
public boolean onItemSingleTapUp(final int index, final OverlayItem item) { public boolean onItemSingleTapUp(final int index, final OverlayItem item) {
Toast.makeText(context, "Measured distance: " + item.getTitle(), Toast.LENGTH_LONG).show(); // TODO make string Toast.makeText(context, item.getTitle() + " | " + item.getSnippet(), Toast.LENGTH_LONG).show();
LogHelper.v(LOG_TAG, "Tap on a track crumb icon detected. Measured distance: " + item.getTitle()); LogHelper.v(LOG_TAG, "Tap on a track crumb icon detected. Measured distance: " + item.getTitle());
return true; return true;
} }
@ -166,4 +164,14 @@ public final class MapHelper {
} }
/* Creates a marker overlay item */
private static OverlayItem createOverlayItem(Context context, Location location) {
// create content of overlay item
final String title = context.getString(R.string.marker_description_source) + ": " + location.getProvider();
final String description = context.getString(R.string.marker_description_accuracy) + ": " + location.getAccuracy();
final GeoPoint position = new GeoPoint(location.getLatitude(),location.getLongitude());
return new OverlayItem(title, description, position);
}
} }

View File

@ -94,8 +94,9 @@ public class NotificationHelper implements TrackbookKeys {
String contentText = mService.getString(R.string.notification_content_distance) + ": " + track.getTrackDistance() + " | " + String contentText = mService.getString(R.string.notification_content_distance) + ": " + track.getTrackDistance() + " | " +
mService.getString(R.string.notification_content_duration) + " : " + track.getTrackDuration(); mService.getString(R.string.notification_content_duration) + " : " + track.getTrackDuration();
// CASE: NOTIFICATION TAP // ACTION: NOTIFICATION TAP
Intent tapActionIntent = new Intent(mService, MainActivity.class); Intent tapActionIntent = new Intent(mService, MainActivity.class);
tapActionIntent.setAction(ACTION_SHOW_MAP);
tapActionIntent.putExtra(EXTRA_TRACK, track); tapActionIntent.putExtra(EXTRA_TRACK, track);
tapActionIntent.putExtra(EXTRA_TRACKING_STATE, tracking); tapActionIntent.putExtra(EXTRA_TRACKING_STATE, tracking);
// artificial back stack for started Activity (https://developer.android.com/training/notify-user/navigation.html#DirectEntry) // artificial back stack for started Activity (https://developer.android.com/training/notify-user/navigation.html#DirectEntry)
@ -103,23 +104,24 @@ public class NotificationHelper implements TrackbookKeys {
tapActionIntentBuilder.addParentStack(MainActivity.class); tapActionIntentBuilder.addParentStack(MainActivity.class);
tapActionIntentBuilder.addNextIntent(tapActionIntent); tapActionIntentBuilder.addNextIntent(tapActionIntent);
// pending intent wrapper for notification tap // pending intent wrapper for notification tap
PendingIntent tapActionPendingIntent = tapActionIntentBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent tapActionPendingIntent = tapActionIntentBuilder.getPendingIntent(10, PendingIntent.FLAG_UPDATE_CURRENT);
// CASE: NOTIFICATION SWIPE // ACTION: NOTIFICATION SWIPE
Intent swipeActionIntent = new Intent(mService, MainActivity.class); Intent swipeActionIntent = new Intent(mService, MainActivity.class);
swipeActionIntent.putExtra(EXTRA_CLEAR_MAP, tracking); swipeActionIntent.setAction(ACTION_SHOW_MAP);
swipeActionIntent.putExtra(EXTRA_CLEAR_MAP, true); // EXTRA_CLEAR_MAP is not (yet) used - map gets cleared by default
// artificial back stack for started Activity (https://developer.android.com/training/notify-user/navigation.html#DirectEntry) // artificial back stack for started Activity (https://developer.android.com/training/notify-user/navigation.html#DirectEntry)
TaskStackBuilder swipeActionIntentBuilder = TaskStackBuilder.create(mService); TaskStackBuilder swipeActionIntentBuilder = TaskStackBuilder.create(mService);
swipeActionIntentBuilder.addParentStack(MainActivity.class); swipeActionIntentBuilder.addParentStack(MainActivity.class);
swipeActionIntentBuilder.addNextIntent(swipeActionIntent); swipeActionIntentBuilder.addNextIntent(swipeActionIntent);
// pending intent wrapper for notification tap // pending intent wrapper for notification tap
PendingIntent swipeActionPendingIntent = swipeActionIntentBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent swipeActionPendingIntent = swipeActionIntentBuilder.getPendingIntent(11, PendingIntent.FLAG_UPDATE_CURRENT);
// CASE: NOTIFICATION BUTTON STOP // ACTION: NOTIFICATION BUTTON STOP
Intent stopActionIntent = new Intent(mService, TrackerService.class); Intent stopActionIntent = new Intent(mService, TrackerService.class);
stopActionIntent.setAction(ACTION_STOP); stopActionIntent.setAction(ACTION_STOP);
// pending intent wrapper for notification stop action // pending intent wrapper for notification stop action
PendingIntent stopActionPendingIntent = PendingIntent.getService(mService, 0, stopActionIntent, 0); PendingIntent stopActionPendingIntent = PendingIntent.getService(mService, 12, stopActionIntent, 0);
// construct notification in builder // construct notification in builder
NotificationCompat.Builder builder; NotificationCompat.Builder builder;
@ -133,8 +135,6 @@ public class NotificationHelper implements TrackbookKeys {
builder.addAction(R.drawable.ic_stop_white_36dp, mService.getString(R.string.notification_stop), stopActionPendingIntent); builder.addAction(R.drawable.ic_stop_white_36dp, mService.getString(R.string.notification_stop), stopActionPendingIntent);
builder.setContentTitle(mService.getString(R.string.notification_title_trackbook_running)); builder.setContentTitle(mService.getString(R.string.notification_title_trackbook_running));
builder.setContentText(contentText); builder.setContentText(contentText);
// third line of text - only appears in expanded view
// builder.setSubText();
} else { } else {
builder.setDeleteIntent(swipeActionPendingIntent); builder.setDeleteIntent(swipeActionPendingIntent);
builder.setContentTitle(mService.getString(R.string.notification_title_trackbook_not_running)); builder.setContentTitle(mService.getString(R.string.notification_title_trackbook_not_running));

View File

@ -23,53 +23,55 @@ package org.y20k.trackbook.helpers;
public interface TrackbookKeys { public interface TrackbookKeys {
/* ACTIONS */ /* ACTIONS */
public static final String ACTION_START = "org.y20k.transistor.action.START"; String ACTION_START = "org.y20k.transistor.action.START";
public static final String ACTION_STOP = "org.y20k.transistor.action.STOP"; String ACTION_STOP = "org.y20k.transistor.action.STOP";
public static final String ACTION_TRACK_UPDATED = "TRACK_UPDATED"; String ACTION_DEFAULT = "DEFAULT";
public static final String ACTION_TRACKING_STOPPED = "TRACKING_STOPPED"; String ACTION_SHOW_MAP = "SHOW_MAP";
String ACTION_TRACK_UPDATED = "TRACK_UPDATED";
String ACTION_TRACKING_STOPPED = "TRACKING_STOPPED";
/* EXTRAS */ /* EXTRAS */
public static final String EXTRA_TRACK = "TRACK"; String EXTRA_TRACK = "TRACK";
public static final String EXTRA_LAST_LOCATION = "LAST_LOCATION"; String EXTRA_LAST_LOCATION = "LAST_LOCATION";
public static final String EXTRA_TRACKING_STATE = "TRACKING_STATE"; String EXTRA_TRACKING_STATE = "TRACKING_STATE";
public static final String EXTRA_CLEAR_MAP = "CLEAR_MAP"; String EXTRA_CLEAR_MAP = "CLEAR_MAP";
public static final String EXTRA_INFOSHEET_TITLE = "EXTRA_INFOSHEET_TITLE"; String EXTRA_INFOSHEET_TITLE = "EXTRA_INFOSHEET_TITLE";
public static final String EXTRA_INFOSHEET_CONTENT = "INFOSHEET_CONTENT"; String EXTRA_INFOSHEET_CONTENT = "INFOSHEET_CONTENT";
/* ARGS */ /* ARGS */
public static final String ARG_PERMISSIONS_GRANTED = "ArgPermissionsGranted"; String ARG_PERMISSIONS_GRANTED = "ArgPermissionsGranted";
/* PREFS */ /* PREFS */
public static final String PREFS_NAME = "org.y20k.trackbook.prefs"; String PREFS_NAME = "org.y20k.trackbook.prefs";
public static final String PREFS_TILE_SOURCE = "tilesource"; String PREFS_TILE_SOURCE = "tileSource";
public static final String PREFS_LATITUDE = "latitude"; String PREFS_LATITUDE = "latitude";
public static final String PREFS_LONGITUDE = "longitude"; String PREFS_LONGITUDE = "longitude";
public static final String PREFS_ZOOM_LEVEL = "zoomLevel"; String PREFS_ZOOM_LEVEL = "zoomLevel";
public static final String PREFS_SHOW_LOCATION = "showLocation"; String PREFS_SHOW_LOCATION = "showLocation";
public static final String PREFS_SHOW_COMPASS = "showCompass"; String PREFS_SHOW_COMPASS = "showCompass";
/* INSTANCE STATE */ /* INSTANCE STATE */
public static final String INSTANCE_FIRST_START = "firstStart"; String INSTANCE_FIRST_START = "firstStart";
public static final String INSTANCE_LATITUDE = "latitude"; String INSTANCE_LATITUDE = "latitude";
public static final String INSTANCE_LONGITUDE = "longitude"; String INSTANCE_LONGITUDE = "longitude";
public static final String INSTANCE_ZOOM_LEVEL = "zoomLevel"; String INSTANCE_ZOOM_LEVEL = "zoomLevel";
public static final String INSTANCE_CURRENT_LOCATION = "currentLocation"; String INSTANCE_CURRENT_LOCATION = "currentLocation";
public static final String INSTANCE_TRACKING_STATE = "trackingState"; String INSTANCE_TRACKING_STATE = "trackingState";
public static final String INSTANCE_TRACK = "track"; String INSTANCE_TRACK = "track";
/* RESULTS */ /* RESULTS */
/* CONSTANTS */ /* CONSTANTS */
public static final long EIGHT_HOURS_IN_MILLISECONDS = 43200000; // maximum tracking duration long EIGHT_HOURS_IN_MILLISECONDS = 43200000; // maximum tracking duration
public static final long FIFTEEN_SECONDS_IN_MILLISECONDS = 15000; // timer interval for tracking long FIFTEEN_SECONDS_IN_MILLISECONDS = 15000; // timer interval for tracking
public static final long FIVE_MINUTES_IN_NANOSECONDS = 5L * 60000000000L; // determines a stop over long FIVE_MINUTES_IN_NANOSECONDS = 5L * 60000000000L; // determines a stop over
public static final long TWO_MINUTES_IN_NANOSECONDS = 2L * 60000000000L; // defines an old location long TWO_MINUTES_IN_NANOSECONDS = 2L * 60000000000L; // defines an old location
public static final long TWELVE_SECONDS_IN_NANOSECONDS = 12000000000L; // defines a new location long TWELVE_SECONDS_IN_NANOSECONDS = 12000000000L; // defines a new location
/* MISC */ /* MISC */
public static final int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124; int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124;
public static final int TRACKER_SERVICE_NOTIFICATION_ID = 1; int TRACKER_SERVICE_NOTIFICATION_ID = 1;
public static final int INFOSHEET_CONTENT_ABOUT = 1; int INFOSHEET_CONTENT_ABOUT = 1;
} }

View File

@ -8,15 +8,15 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/activity_horizontal_margin" android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:scrollbars="vertical"> android:scrollbars="vertical">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/layout_onboading_h1_welcome" android:text="@string/layout_onboarding_h1_welcome"
android:id="@+id/h1_welcome" /> android:id="@+id/h1_welcome" />
<LinearLayout <LinearLayout

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -5,12 +5,13 @@
<color name="trackbook_red_dark">#FFB71C1C</color> <color name="trackbook_red_dark">#FFB71C1C</color>
<color name="trackbook_gold">#FFE6BA64</color> <color name="trackbook_gold">#FFE6BA64</color>
<color name="trackbook_blue">#FF2095F2</color> <color name="trackbook_blue">#FF2095F2</color>
<color name="trackbook_blue_dark">#FF12537F</color>
<color name="trackbook_white">#FFFFFFFF</color> <color name="trackbook_white">#FFFFFFFF</color>
<color name="trackbook_grey_light">#FF607d8b</color> <color name="trackbook_grey_light">#FF607d8b</color>
<color name="trackbook_grey">#FF455a64</color> <color name="trackbook_grey">#FF455a64</color>
</resources> </resources>

View File

@ -27,30 +27,31 @@
<string name="toast_message_unable_to_start_app">Unable to start Trackbook.</string> <string name="toast_message_unable_to_start_app">Unable to start Trackbook.</string>
<string name="toast_message_location_offline">Location is turned off.</string> <string name="toast_message_location_offline">Location is turned off.</string>
<string name="toast_message_acquiring_location">Acquiring current location.</string> <string name="toast_message_acquiring_location">Acquiring current location.</string>
<string name="toast_message_my_location">Last recorded location:</string> <string name="toast_message_last_location">Last location:</string>
<string name="toast_message_last_location_age_one_hour">over one hour</string>
<!-- map markers --> <!-- map markers -->
<string name="marker_my_location_title">My current location.</string> <string name="marker_description_source">Source</string>
<string name="marker_my_location_description">This marker represents the user\'s current location on the map.</string> <string name="marker_description_accuracy">Accuracy</string>
<!-- onboading layout --> <!-- onboading layout -->
<string name="layout_onboading_h1_welcome">Welcome onboard</string> <string name="layout_onboarding_h1_welcome">Hello</string>
<string name="layout_onboading_description_app_icon">Trackbook App Icon</string> <string name="layout_onboading_description_app_icon">Trackbook App Icon</string>
<string name="layout_onboading_h2_app_name">Trackbook</string> <string name="layout_onboading_h2_app_name">Trackbook</string>
<string name="layout_onboading_p_app_claim">Movement Recorder for Android</string> <string name="layout_onboading_p_app_claim">Movement Recorder for Android</string>
<string name="layout_onboading_h2_request_permissions">Trackbook cannot work without these permissions:</string> <string name="layout_onboading_h2_request_permissions">Trackbook cannot work without these permissions:</string>
<string name="layout_onboading_h3_permission_location">LOCATION</string> <string name="layout_onboading_h3_permission_location">LOCATION</string>
<string name="layout_onboading_p_permission_location">Maxime et commodi modi officiis at deleniti fugit. Magnam atque provident est et nulla incidunt. Beatae excepturi repudiandae aut facilis aperiam. Et totam qui doloremque. Asperiores est ut perspiciatis ducimus ut aut rerum minus. Voluptatem facilis qui minus corporis explicabo eos.</string> <string name="layout_onboading_p_permission_location">Trackbook needs accurate GPS location data to be able to record your movements. If the GPS data is not available or not accurate enough Trackbook uses location data from cell tower and WiFi triangulation.</string>
<string name="layout_onboading_h3_permission_storage">STORAGE</string> <string name="layout_onboading_h3_permission_storage">STORAGE</string>
<string name="layout_onboading_p_permission_storage">Maxime et commodi modi officiis at deleniti fugit. Magnam atque provident est et nulla incidunt. Beatae excepturi repudiandae aut facilis aperiam. Et totam qui doloremque. Asperiores est ut perspiciatis ducimus ut aut rerum minus. Voluptatem facilis qui minus corporis explicabo eos.</string> <string name="layout_onboading_p_permission_storage">Trackbook uses osmdroid, which caches map tiles on Android\'s external storage. You can find the map cache in the osmdroid folder on the top level of the user-facing file system.</string>
<string name="layout_onboading_button_okay">Got it!</string> <string name="layout_onboading_button_okay">Got it!</string>
<!-- infosheet about --> <!-- infosheet about -->
<string name="infosheet_about_h1_about">About Trackbook</string> <string name="infosheet_about_h1_about">About Trackbook</string>
<string name="infosheet_about_h2_recorder">Movement recorder for Android</string> <string name="infosheet_about_h2_recorder">Movement Recorder for Android</string>
<string name="infosheet_about_h3_version">Version 0.1 ("The Great Gig in the Sky")</string> <string name="infosheet_about_h3_version">Version 0.1 ("The Great Gig in the Sky")</string>
<string name="infosheet_about_p_bare">Trackbook is a bare bones app for recording your movements. Trackbook is great for hiking, vacation or workout. Once started it displays your movements on a map. You can save your recorded tracks and share them with friends.</string> <string name="infosheet_about_p_bare">Trackbook is a bare bones app for recording your movements. Trackbook is great for hiking, vacation or workout. Once started it displays your movements on a map. You can save your recorded tracks and share them with friends.</string>
<string name="infosheet_about_p_free">Trackbook is free software. It is published under the MIT open source license. Trackbook uses osmdroid to display the map. osmdroid is also free software. It is published under the Apache License. Want to help? You can find the code on GitHub. GitHub is also a good place to file bugs or even to contribute, if you are interested.</string> <string name="infosheet_about_p_free">Trackbook is free software. You can find the code on GitHub. GitHub is also a good place to file bugs or even to contribute, if you are interested. Trackbook is published under the MIT open source license. Trackbook uses osmdroid to display the map, which is also free software published under the Apache License.</string>
<string name="infosheet_about_p_github">https://github.com/y20k/trackbook</string> <string name="infosheet_about_p_github">https://github.com/y20k/trackbook</string>
<string name="infosheet_about_p_osmdroid">https://github.com/osmdroid/osmdroid</string> <string name="infosheet_about_p_osmdroid">https://github.com/osmdroid/osmdroid</string>
<string name="infosheet_about_p_license">https://opensource.org/licenses/MIT</string> <string name="infosheet_about_p_license">https://opensource.org/licenses/MIT</string>