diff options
author | jkoan <jkoan@users.noreply.github.com> | 2017-11-24 07:12:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-24 07:12:44 +0100 |
commit | e74a46b71078822cfc888967cc427aeeb3b08653 (patch) | |
tree | 4e185ce6f13cd3a0330828f2f0b167664967dc82 | |
parent | 83753fe4a4def403228325032228b453f2be0c71 (diff) | |
parent | 41f50278bea098ea98f5d77c94a706517ddc7798 (diff) | |
download | navit-semver_changelog.tar.gz |
Merge branch 'trunk' into semver_changelogsemver_changelog
-rw-r--r-- | navit/android/src/org/navitproject/navit/Navit.java | 21 | ||||
-rw-r--r-- | navit/route.c | 19 | ||||
-rw-r--r-- | navit/util.c | 17 |
3 files changed, 44 insertions, 13 deletions
diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java index d3b970e98..7505e7ff7 100644 --- a/navit/android/src/org/navitproject/navit/Navit.java +++ b/navit/android/src/org/navitproject/navit/Navit.java @@ -80,6 +80,7 @@ import android.view.inputmethod.InputMethodManager; import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
+import android.support.v4.app.NotificationCompat;
public class Navit extends Activity
@@ -119,6 +120,7 @@ public class Navit extends Activity public static final String NAVIT_PREFS = "NavitPrefs";
Boolean isFullscreen = false;
private static final int MY_PERMISSIONS_REQUEST_ALL = 101;
+ public static NotificationManager nm;
/**
@@ -292,13 +294,17 @@ public class Navit extends Activity // NOTIFICATION
// Setup the status bar notification
// This notification is removed in the exit() function
- NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
- Notification NavitNotification = new Notification(R.drawable.ic_notify, getString(R.string.notification_ticker), System.currentTimeMillis()); // Create a new notification, with the text string to show when the notification first appears
+ nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);
- //FIXME : needs a fix for sdk 23
- //NavitNotification.setLatestEventInfo(getApplicationContext(), "Navit", getString(R.string.notification_event_default), appIntent); // Set the text in the notification
- //NavitNotification.flags|=Notification.FLAG_ONGOING_EVENT; // Ensure that the notification appears in Ongoing
- nm.notify(R.string.app_name, NavitNotification); // Set the notification
+
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
+ builder.setContentIntent(appIntent);
+ builder.setAutoCancel(false).setOngoing(true);
+ builder.setContentTitle(getString(R.string.app_name));
+ builder.setContentText(getString(R.string.notification_event_default));
+ builder.setSmallIcon(R.drawable.ic_notify);
+ Notification NavitNotification = builder.build();
+ nm.notify(R.string.app_name, NavitNotification);// Show the notification
// Status and navigation bar sizes
// These are platform defaults and do not change with rotation, but we have to figure out which ones apply
@@ -906,8 +912,7 @@ public class Navit extends Activity public void exit()
{
-// NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
-// nm.cancel(R.string.app_name);
+ nm.cancelAll();
NavitVehicle.removeListener();
NavitDestroy();
}
diff --git a/navit/route.c b/navit/route.c index 364bd390c..2251ffb7f 100644 --- a/navit/route.c +++ b/navit/route.c @@ -2155,6 +2155,15 @@ route_value_seg(struct vehicleprofile *profile, struct route_graph_point *from, return ret; } +/** + * @brief Whether two route graph segments match. + * + * Two segments match if both start and end at the exact same points. Other points are not considered. + * + * @param s1 The first segment + * @param s2 The second segment + * @return true if both segments match, false if not + */ static int route_graph_segment_match(struct route_graph_segment *s1, struct route_graph_segment *s2) { @@ -2167,11 +2176,13 @@ route_graph_segment_match(struct route_graph_segment *s1, struct route_graph_seg /** * @brief Sets or clears a traffic distortion for a segment. * - * This sets or clears a delay. It cannot be used to set speed. + * This sets a delay (setting speed is not supported) or clears an existing traffic distortion. + * Note that, although setting a speed is not supported, calling this function with a delay of 0 + * will also clear an existing speed constraint. * * @param this The route graph * @param seg The segment to which the traffic distortion applies - * @param delay Delay in tenths of a second + * @param delay Delay in tenths of a second, or 0 to clear an existing traffic distortion */ static void route_graph_set_traffic_distortion(struct route_graph *this, struct route_graph_segment *seg, int delay) @@ -2204,10 +2215,10 @@ route_graph_set_traffic_distortion(struct route_graph *this, struct route_graph_ } /** - * @brief Adds a route distortion item to the route graph + * @brief Adds a traffic distortion item to the route graph * * @param this The route graph to add to - * @param item The item to add + * @param item The item to add, must be of {@code type_traffic_distortion} */ static void route_process_traffic_distortion(struct route_graph *this, struct item *item) diff --git a/navit/util.c b/navit/util.c index 2cceae460..79c92379e 100644 --- a/navit/util.c +++ b/navit/util.c @@ -709,7 +709,22 @@ void spawn_process_init() return; } -/** Get printable compass direction from an angle. */ +/** + * @brief Get printable compass direction from an angle. + * + * This function supports three different modes: + * + * In mode 0, the angle in degrees is output as a string. + * + * In mode 1, the angle is output as a cardinal direction (N, SE etc.). + * + * In mode 2, the angle is output in analog clock notation (6 o'clock). + * + * @param buffer Buffer to hold the result string (up to 5 characters, including the terminating null + * character, may be required) + * @param angle The angle to convert + * @param mode The conversion mode, see description + */ void get_compass_direction(char *buffer, int angle, int mode) { |