From 445697c7f66dadf79abce19c224da404d647ee30 Mon Sep 17 00:00:00 2001 From: mvglasow Date: Fri, 17 Nov 2017 22:17:09 +0100 Subject: Refactor:route:Improve documentation (#372) * Refactor:route:Improve documentation Signed-off-by: mvglasow * Refactor:core:Refine documentation Signed-off-by: mvglasow --- navit/route.c | 19 +++++++++++++++---- navit/util.c | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 5 deletions(-) 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) { -- cgit v1.2.1 From 41f50278bea098ea98f5d77c94a706517ddc7798 Mon Sep 17 00:00:00 2001 From: jkoan Date: Thu, 23 Nov 2017 19:23:05 +0100 Subject: fix:android:reworked notification system for sdk 23 (#374) * fix:android:Made main notification working again. It now uses NotificationCompat from android support to support android from api 4 and up. * fix:android:Made main notification working again. It now uses NotificationCompat from android support to support android from api 4 and up. --- navit/android/src/org/navitproject/navit/Navit.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 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(); } -- cgit v1.2.1