summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
Diffstat (limited to 'navit')
-rw-r--r--navit/android/src/org/navitproject/navit/Navit.java30
-rw-r--r--navit/android/src/org/navitproject/navit/NavitGraphics.java264
-rw-r--r--navit/gui/internal/CMakeLists.txt4
-rw-r--r--navit/gui/internal/gui_internal_widget.c78
-rw-r--r--navit/navit_shipped.xml3
-rw-r--r--navit/vehicle/gpsd/vehicle_gpsd.c4
-rw-r--r--navit/xslt/android.xslt3
7 files changed, 272 insertions, 114 deletions
diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java
index e6a477a37..fb10d56dd 100644
--- a/navit/android/src/org/navitproject/navit/Navit.java
+++ b/navit/android/src/org/navitproject/navit/Navit.java
@@ -20,6 +20,7 @@
package org.navitproject.navit;
import android.Manifest;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -75,11 +76,6 @@ public class Navit extends Activity {
private NavitActivityResult[] ActivityResults;
public static InputMethodManager mgr = null;
public static DisplayMetrics metrics = null;
- public static int status_bar_height = 0;
- private static int action_bar_default_height = 0;
- public static int navigation_bar_height = 0;
- public static int navigation_bar_height_landscape = 0;
- public static int navigation_bar_width = 0;
public static Boolean show_soft_keyboard = false;
public static Boolean show_soft_keyboard_now_showing = false;
public static long last_pressed_menu_key = 0L;
@@ -354,25 +350,6 @@ public class Navit extends Activity {
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
- // (is the navigation bar visible? on the side or at the bottom?)
- Resources resources = getResources();
- int shid = resources.getIdentifier("status_bar_height", "dimen", "android");
- int adhid = resources.getIdentifier("action_bar_default_height", "dimen", "android");
- int nhid = resources.getIdentifier("navigation_bar_height", "dimen", "android");
- int nhlid = resources.getIdentifier("navigation_bar_height_landscape", "dimen", "android");
- int nwid = resources.getIdentifier("navigation_bar_width", "dimen", "android");
- status_bar_height = (shid > 0) ? resources.getDimensionPixelSize(shid) : 0;
- action_bar_default_height = (adhid > 0) ? resources.getDimensionPixelSize(adhid) : 0;
- navigation_bar_height = (nhid > 0) ? resources.getDimensionPixelSize(nhid) : 0;
- navigation_bar_height_landscape = (nhlid > 0) ? resources.getDimensionPixelSize(nhlid) : 0;
- navigation_bar_width = (nwid > 0) ? resources.getDimensionPixelSize(nwid) : 0;
- Log.d(TAG, String.format(
- "status_bar_height=%d, action_bar_default_height=%d, navigation_bar_height=%d, "
- + "navigation_bar_height_landscape=%d, navigation_bar_width=%d",
- status_bar_height, action_bar_default_height, navigation_bar_height,
- navigation_bar_height_landscape, navigation_bar_width));
if ((ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
|| (ContextCompat.checkSelfPermission(this,
@@ -502,6 +479,7 @@ public class Navit extends Activity {
}
}
Log.d(TAG, "onResume");
+
if (show_soft_keyboard_now_showing) {
/* Calling showNativeKeyboard() directly won't work here, we need to use the message queue */
View cf = getCurrentFocus();
@@ -891,10 +869,6 @@ public class Navit extends Activity {
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "OnDestroy");
- // next call will kill our app the hard way. This should not be necessary, but ensures navit is
- // properly restarted and no resources are wasted with navit in background. Remove this call after
- // code review
- NavitDestroy();
}
public void fullscreen(int fullscreen) {
diff --git a/navit/android/src/org/navitproject/navit/NavitGraphics.java b/navit/android/src/org/navitproject/navit/NavitGraphics.java
index ba6b87bde..f85c24833 100644
--- a/navit/android/src/org/navitproject/navit/NavitGraphics.java
+++ b/navit/android/src/org/navitproject/navit/NavitGraphics.java
@@ -20,9 +20,11 @@
package org.navitproject.navit;
import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
@@ -43,6 +45,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup.LayoutParams;
+import android.view.WindowInsets;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
@@ -64,9 +67,15 @@ public class NavitGraphics {
private int bgcolor;
private float trackball_x;
private float trackball_y;
+ private int padding_left = 0;
+ private int padding_right = 0;
+ private int padding_top = 0;
+ private int padding_bottom = 0;
private View view;
- private SystemBarTintView navigationTintView;
- private SystemBarTintView statusTintView;
+ private SystemBarTintView leftTintView;
+ private SystemBarTintView rightTintView;
+ private SystemBarTintView topTintView;
+ private SystemBarTintView bottomTintView;
private FrameLayout frameLayout;
private RelativeLayout relativelayout;
private NavitCamera camera;
@@ -80,11 +89,17 @@ public class NavitGraphics {
public void setBackgroundColor(int bgcolor) {
this.bgcolor = bgcolor;
- if (navigationTintView != null) {
- navigationTintView.setBackgroundColor(bgcolor);
+ if (leftTintView != null) {
+ leftTintView.setBackgroundColor(bgcolor);
}
- if (statusTintView != null) {
- statusTintView.setBackgroundColor(bgcolor);
+ if (rightTintView != null) {
+ rightTintView.setBackgroundColor(bgcolor);
+ }
+ if (topTintView != null) {
+ topTintView.setBackgroundColor(bgcolor);
+ }
+ if (bottomTintView != null) {
+ bottomTintView.setBackgroundColor(bgcolor);
}
}
@@ -146,6 +161,22 @@ public class NavitGraphics {
}
@Override
+ @TargetApi(20)
+ public WindowInsets onApplyWindowInsets (WindowInsets insets) {
+ /*
+ * We're skipping the top inset here because it appears to have a bug on most Android versions tested,
+ * causing it to report between 24 and 64 dip more than what is actually occupied by the system UI.
+ * The top inset is retrieved in handleResize(), with logic depending on the platform version.
+ */
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT_WATCH) {
+ padding_left = insets.getSystemWindowInsetLeft();
+ padding_right = insets.getSystemWindowInsetRight();
+ padding_bottom = insets.getSystemWindowInsetBottom();
+ }
+ return super.onApplyWindowInsets(insets);
+ }
+
+ @Override
protected void onCreateContextMenu(ContextMenu menu) {
super.onCreateContextMenu(menu);
@@ -574,10 +605,14 @@ public class NavitGraphics {
if (Build.VERSION.SDK_INT >= 19) {
frameLayout = new FrameLayout(activity);
frameLayout.addView(relativelayout);
- navigationTintView = new SystemBarTintView(activity);
- statusTintView = new SystemBarTintView(activity);
- frameLayout.addView(navigationTintView);
- frameLayout.addView(statusTintView);
+ leftTintView = new SystemBarTintView(activity);
+ rightTintView = new SystemBarTintView(activity);
+ topTintView = new SystemBarTintView(activity);
+ bottomTintView = new SystemBarTintView(activity);
+ frameLayout.addView(leftTintView);
+ frameLayout.addView(rightTintView);
+ frameLayout.addView(topTintView);
+ frameLayout.addView(bottomTintView);
activity.setContentView(frameLayout);
} else {
activity.setContentView(relativelayout);
@@ -688,82 +723,44 @@ public class NavitGraphics {
*
*/
private void adjustSystemBarsTintingViews() {
-
- /* frameLayout is only created on platforms supporting navigation and status bar tinting */
- if (frameLayout == null) {
- return;
- }
- if (activity == null) {
- Log.w(TAG, "Main Activity is not a Navit instance, cannot update padding");
- return;
- }
-
- Navit navit = activity;
-
- /*
- * Determine visibility of status bar.
- * The status bar is always visible unless we are in fullscreen mode.
- */
- final Boolean isStatusShowing = !navit.isFullscreen;
-
- /*
- * Determine visibility of navigation bar.
- * This logic is based on the presence of a hardware menu button and is known to work on
- * devices which allow switching between hw and sw buttons (OnePlus One running CyanogenMod).
- */
- final Boolean isNavShowing = !ViewConfigurationCompat.hasPermanentMenuKey(ViewConfiguration.get(navit));
- Log.d(TAG, String.format("isStatusShowing=%b isNavShowing=%b", isStatusShowing, isNavShowing));
-
- /*
- * Determine where the navigation bar would be displayed.
- * Logic is taken from AOSP RenderSessionImpl.findNavigationBar()
- * platform/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
- */
- final Boolean isLandscape = (navit.getResources().getConfiguration().orientation
- == Configuration.ORIENTATION_LANDSCAPE);
- final Boolean isNavAtBottom = (!isLandscape)
- || (navit.getResources().getConfiguration().smallestScreenWidthDp >= 600);
- Log.d(TAG, String.format("isNavAtBottom=%b (Configuration.smallestScreenWidthDp=%d, isLandscape=%b)",
- isNavAtBottom, navit.getResources().getConfiguration().smallestScreenWidthDp, isLandscape));
-
- int left = 0;
- int top = isStatusShowing ? Navit.status_bar_height : 0;
- int right = (isNavShowing && !isNavAtBottom) ? Navit.navigation_bar_width : 0;
- final int bottom = (!(isNavShowing
- && isNavAtBottom)) ? 0 : (
- isLandscape ? Navit.navigation_bar_height_landscape : Navit.navigation_bar_height);
-
/* hide tint bars during update to prevent ugly effects */
- statusTintView.setVisibility(View.GONE);
- navigationTintView.setVisibility(View.GONE);
+ leftTintView.setVisibility(View.GONE);
+ rightTintView.setVisibility(View.GONE);
+ topTintView.setVisibility(View.GONE);
+ bottomTintView.setVisibility(View.GONE);
frameLayout.post(new Runnable() {
@Override
public void run() {
- statusTintView.setVisibility(isStatusShowing ? View.VISIBLE : View.GONE);
- FrameLayout.LayoutParams statusLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
- Navit.status_bar_height, Gravity.TOP);
-
- /* Prevent tint views from overlapping when navigation is on the right */
- statusLayoutParams.setMargins(0, 0,
- (isNavShowing && !isNavAtBottom) ? Navit.navigation_bar_width : 0, 0);
- statusTintView.setLayoutParams(statusLayoutParams);
- Log.d(TAG, String.format("statusTintView: width=%d height=%d",
- statusTintView.getWidth(), statusTintView.getHeight()));
- navigationTintView.setVisibility(isNavShowing ? View.VISIBLE : View.GONE);
- LayoutParams navigationLayoutParams = new FrameLayout.LayoutParams(
- isNavAtBottom ? LayoutParams.MATCH_PARENT : Navit.navigation_bar_width, // X
- isNavAtBottom ? bottom : LayoutParams.MATCH_PARENT, // Y
- Gravity.BOTTOM | Gravity.RIGHT);
- navigationTintView.setLayoutParams(navigationLayoutParams);
- Log.d(TAG, String.format("navigationTintView: width=%d height=%d",
- navigationTintView.getWidth(), navigationTintView.getHeight()));
+ FrameLayout.LayoutParams leftLayoutParams = new FrameLayout.LayoutParams(padding_left,
+ LayoutParams.MATCH_PARENT, Gravity.BOTTOM | Gravity.LEFT);
+ leftTintView.setLayoutParams(leftLayoutParams);
+
+ FrameLayout.LayoutParams rightLayoutParams = new FrameLayout.LayoutParams(padding_right,
+ LayoutParams.MATCH_PARENT, Gravity.BOTTOM | Gravity.RIGHT);
+ rightTintView.setLayoutParams(rightLayoutParams);
+
+ FrameLayout.LayoutParams topLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
+ padding_top, Gravity.TOP);
+ /* Prevent horizontal and vertical tint views from overlapping */
+ topLayoutParams.setMargins(padding_left, 0, padding_right, 0);
+ topTintView.setLayoutParams(topLayoutParams);
+
+ FrameLayout.LayoutParams bottomLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
+ padding_bottom, Gravity.BOTTOM);
+ /* Prevent horizontal and vertical tint views from overlapping */
+ bottomLayoutParams.setMargins(padding_left, 0, padding_right, 0);
+ bottomTintView.setLayoutParams(bottomLayoutParams);
+
+ /* show tint bars again */
+ leftTintView.setVisibility(View.VISIBLE);
+ rightTintView.setVisibility(View.VISIBLE);
+ topTintView.setVisibility(View.VISIBLE);
+ bottomTintView.setVisibility(View.VISIBLE);
}
});
- Log.d(TAG, String.format("Padding left=%d top=%d right=%d bottom=%d", left, top, right, bottom));
-
- PaddingChangedCallback(PaddingChangedCallbackID, left, top, right, bottom);
+ PaddingChangedCallback(PaddingChangedCallbackID, padding_left, padding_top, padding_right, padding_bottom);
}
/**
@@ -773,12 +770,123 @@ public class NavitGraphics {
* {@code onSizeChanged()} event handler fires or when toggling Fullscreen mode.
*
*/
+ @TargetApi(23)
public void handleResize(int w, int h) {
if (this.parent_graphics != null) {
this.parent_graphics.handleResize(w, h);
} else {
Log.d(TAG, String.format("handleResize w=%d h=%d", w, h));
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
+ /*
+ * On API 23+ we can query window insets to determine the area which is obscured by the system bars.
+ * This appears to have a bug, though, causing an inset to be reported for the navigation bar even
+ * when it is not obstructing the window. Therefore, we are relying on the values previously obtained
+ * by NavitView#onApplyWindowInsets(), though this is affected by a different bug. Luckily, the two
+ * bugs appear to be complementary, allowing us to mix and match results.
+ */
+ if (view == null) {
+ Log.w(TAG, "view is null, cannot update padding");
+ } else {
+ Log.d(TAG, String.format("view w=%d h=%d x=%.0f y=%.0f",
+ view.getWidth(), view.getHeight(), view.getX(), view.getY()));
+ if (view.getRootWindowInsets() == null)
+ Log.w(TAG, "No root window insets, cannot update padding");
+ else {
+ Log.d(TAG, String.format("RootWindowInsets left=%d right=%d top=%d bottom=%d",
+ view.getRootWindowInsets().getSystemWindowInsetLeft(),
+ view.getRootWindowInsets().getSystemWindowInsetRight(),
+ view.getRootWindowInsets().getSystemWindowInsetTop(),
+ view.getRootWindowInsets().getSystemWindowInsetBottom()));
+ padding_top = view.getRootWindowInsets().getSystemWindowInsetTop();
+ }
+ }
+ } else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT_WATCH) {
+ /*
+ * API 20-22 do not support root window insets, forcing us to make an educated guess about the
+ * navigation bar height:
+ *
+ * The size is a platform default and does not change with rotation, but we have to figure out if it
+ * applies, i.e. if the status bar is visible.
+ *
+ * The status bar is always visible unless we are in fullscreen mode. (Fortunately, none of the
+ * versions affected by this support split screen mode, which would have further complicated things.)
+ */
+ if (activity.isFullscreen)
+ padding_top = 0;
+ else {
+ Resources resources = view.getResources();
+ int shid = resources.getIdentifier("status_bar_height", "dimen", "android");
+ padding_top = (shid > 0) ? resources.getDimensionPixelSize(shid) : 0;
+ }
+ } else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
+ /*
+ * API 19 does not support window insets at all, forcing us to do even more guessing than on API 20-22:
+ *
+ * All system bar sizes are platform defaults and do not change with rotation, but we have
+ * to figure out which ones apply.
+ *
+ * Status bar visibility is as on API 20-22.
+ *
+ * The navigation bar is shown on devices that report they have no physical menu button. This seems to
+ * work even on devices that allow disabling the physical buttons (and use the navigation bar, in which
+ * case they report no physical menu button is available; tested with a OnePlus One running CyanogenMod).
+ *
+ * If shown, the navigation bar may appear on the side or at the bottom. The logic to determine this is
+ * taken from AOSP RenderSessionImpl.findNavigationBar()
+ * platform/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+ */
+ Resources resources = view.getResources();
+ int shid = resources.getIdentifier("status_bar_height", "dimen", "android");
+ int adhid = resources.getIdentifier("action_bar_default_height", "dimen", "android");
+ int nhid = resources.getIdentifier("navigation_bar_height", "dimen", "android");
+ int nhlid = resources.getIdentifier("navigation_bar_height_landscape", "dimen", "android");
+ int nwid = resources.getIdentifier("navigation_bar_width", "dimen", "android");
+ int status_bar_height = (shid > 0) ? resources.getDimensionPixelSize(shid) : 0;
+ int action_bar_default_height = (adhid > 0) ? resources.getDimensionPixelSize(adhid) : 0;
+ int navigation_bar_height = (nhid > 0) ? resources.getDimensionPixelSize(nhid) : 0;
+ int navigation_bar_height_landscape = (nhlid > 0) ? resources.getDimensionPixelSize(nhlid) : 0;
+ int navigation_bar_width = (nwid > 0) ? resources.getDimensionPixelSize(nwid) : 0;
+ Log.d(TAG, String.format(
+ "status_bar_height=%d, action_bar_default_height=%d, navigation_bar_height=%d, "
+ + "navigation_bar_height_landscape=%d, navigation_bar_width=%d",
+ status_bar_height, action_bar_default_height, navigation_bar_height,
+ navigation_bar_height_landscape, navigation_bar_width));
+
+ if (activity == null) {
+ Log.w(TAG, "Main Activity is not a Navit instance, cannot update padding");
+ } else if (frameLayout != null) {
+ /* frameLayout is only created on platforms supporting navigation and status bar tinting */
+
+ Navit navit = activity;
+ boolean isStatusShowing = !navit.isFullscreen;
+ boolean isNavShowing = !ViewConfigurationCompat.hasPermanentMenuKey(ViewConfiguration.get(navit));
+ Log.d(TAG, String.format("isStatusShowing=%b isNavShowing=%b", isStatusShowing, isNavShowing));
+
+ boolean isLandscape = (navit.getResources().getConfiguration().orientation
+ == Configuration.ORIENTATION_LANDSCAPE);
+ boolean isNavAtBottom = (!isLandscape)
+ || (navit.getResources().getConfiguration().smallestScreenWidthDp >= 600);
+ Log.d(TAG, String.format("isNavAtBottom=%b (Configuration.smallestScreenWidthDp=%d, isLandscape=%b)",
+ isNavAtBottom, navit.getResources().getConfiguration().smallestScreenWidthDp, isLandscape));
+
+ padding_left = 0;
+ padding_top = isStatusShowing ? status_bar_height : 0;
+ padding_right = (isNavShowing && !isNavAtBottom) ? navigation_bar_width : 0;
+ padding_bottom = (!(isNavShowing && isNavAtBottom)) ? 0 : (
+ isLandscape ? navigation_bar_height_landscape : navigation_bar_height);
+ }
+ } else {
+ /* API 18 and below does not support drawing under the system bars, padding is 0 all around */
+ padding_left = 0;
+ padding_right = 0;
+ padding_top = 0;
+ padding_bottom = 0;
+ }
+
+ Log.d(TAG, String.format("Padding left=%d top=%d right=%d bottom=%d",
+ padding_left, padding_top, padding_right, padding_bottom));
+
adjustSystemBarsTintingViews();
draw_bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
diff --git a/navit/gui/internal/CMakeLists.txt b/navit/gui/internal/CMakeLists.txt
index b758ba7e6..27011bab3 100644
--- a/navit/gui/internal/CMakeLists.txt
+++ b/navit/gui/internal/CMakeLists.txt
@@ -1,3 +1,7 @@
+if (GUI_INTERNAL_VISUAL_DBG)
+ add_definitions ("-DGUI_INTERNAL_VISUAL_DBG")
+endif(GUI_INTERNAL_VISUAL_DBG)
+
module_add_library(gui_internal gui_internal.c gui_internal_bookmark.c gui_internal_command.c gui_internal_gesture.c
gui_internal_html.c gui_internal_menu.c gui_internal_poi.c gui_internal_search.c gui_internal_widget.c
gui_internal_keyboard.c)
diff --git a/navit/gui/internal/gui_internal_widget.c b/navit/gui/internal/gui_internal_widget.c
index 0894be5aa..3b979f011 100644
--- a/navit/gui/internal/gui_internal_widget.c
+++ b/navit/gui/internal/gui_internal_widget.c
@@ -358,13 +358,37 @@ gui_internal_box_new(struct gui_priv *this, enum flags flags) {
return gui_internal_box_new_with_label(this, flags, NULL);
}
-
+/**
+ * @brief Renders a box widget, preparing it for drawing on the display
+ *
+ * @param this The internal GUI instance
+ * @param w The box widget to render
+ */
static void gui_internal_box_render(struct gui_priv *this, struct widget *w) {
struct widget *wc;
GList *l;
+ int visual_debug = 0;
+
+#if defined(GUI_INTERNAL_VISUAL_DBG)
+ static struct graphics_gc *debug_gc=NULL;
+ static struct color gui_box_debug_color= {0xffff,0x0400,0x0400,0xffff}; /* Red */
+ visual_debug = (debug_level_get("gui_internal_visual_layout") >= lvl_debug);
+#endif
+
+ if (visual_debug)
+ dbg(lvl_debug, "Internal layout visual debugging is enabled");
+
+#if defined(GUI_INTERNAL_VISUAL_DBG)
+ if (visual_debug && !debug_gc) {
+ debug_gc = graphics_gc_new(this->gra);
+ graphics_gc_set_foreground(debug_gc, &gui_box_debug_color);
+ graphics_gc_set_linewidth(debug_gc, 1);
+ }
+#endif
+
gui_internal_background_render(this, w);
- if (w->foreground && w->border) {
+ if ((w->foreground && w->border) || visual_debug) {
struct point pnt[5];
pnt[0]=w->p;
pnt[1].x=pnt[0].x+w->w;
@@ -374,9 +398,15 @@ static void gui_internal_box_render(struct gui_priv *this, struct widget *w) {
pnt[3].x=pnt[0].x;
pnt[3].y=pnt[0].y+w->h;
pnt[4]=pnt[0];
- graphics_gc_set_linewidth(w->foreground, w->border ? w->border : 1);
- graphics_draw_lines(this->gra, w->foreground, pnt, 5);
- graphics_gc_set_linewidth(w->foreground, 1);
+ if (!visual_debug) {
+ graphics_gc_set_linewidth(w->foreground, w->border ? w->border : 1);
+ graphics_draw_lines(this->gra, w->foreground, pnt, 5);
+ graphics_gc_set_linewidth(w->foreground, 1);
+ }
+#if defined(GUI_INTERNAL_VISUAL_DBG)
+ else
+ graphics_draw_lines(this->gra, debug_gc, pnt, 5); /* Force highlighting box borders in debug more */
+#endif
}
l=w->children;
@@ -1247,10 +1277,10 @@ void gui_internal_table_hide_rows(struct table_data * table_data) {
/**
- * @brief Renders a table widget.
+ * @brief Renders a table widget, preparing it for drawing on the display
*
- * @param this The graphics context
- * @param w The table widget to render.
+ * @param this The internal GUI instance
+ * @param w The widget to render
*/
void gui_internal_table_render(struct gui_priv * this, struct widget * w) {
@@ -1347,9 +1377,41 @@ void gui_internal_table_render(struct gui_priv * this, struct widget * w) {
} else {
cur_widget->state &= ~STATE_OFFSCREEN;
}
+
+#if defined(GUI_INTERNAL_VISUAL_DBG)
+
+ static struct graphics_gc *debug_gc=NULL;
+ static struct color gui_table_debug_color= {0x0000,0xffff,0x0400,0xffff}; /* Green */
+ int visual_debug = (debug_level_get("gui_internal_visual_layout") >= lvl_debug);
+
+ if (visual_debug)
+ dbg(lvl_debug, "Internal layout visual debugging is enabled");
+
+ if (visual_debug && !debug_gc) {
+ debug_gc = graphics_gc_new(this->gra);
+ graphics_gc_set_foreground(debug_gc, &gui_table_debug_color);
+ graphics_gc_set_linewidth(debug_gc, 1);
+ }
+#endif
+
gui_internal_widget_pack(this,cur_widget);
gui_internal_widget_render(this,cur_widget);
+#if defined(GUI_INTERNAL_VISUAL_DBG)
+ if (visual_debug) {
+ struct point pnt[5];
+ pnt[0]=cur_widget->p;
+ pnt[1].x=pnt[0].x+cur_widget->w;
+ pnt[1].y=pnt[0].y;
+ pnt[2].x=pnt[0].x+cur_widget->w;
+ pnt[2].y=pnt[0].y+cur_widget->h;
+ pnt[3].x=pnt[0].x;
+ pnt[3].y=pnt[0].y+cur_widget->h;
+ pnt[4]=pnt[0];
+ graphics_draw_lines(this->gra, debug_gc, pnt, 5); /* Force highlighting table borders in debug more */
+ }
+#endif
+
if(dim->height > max_height) {
max_height = dim->height;
}
diff --git a/navit/navit_shipped.xml b/navit/navit_shipped.xml
index 9e87d2fba..409b149e8 100644
--- a/navit/navit_shipped.xml
+++ b/navit/navit_shipped.xml
@@ -185,6 +185,9 @@ Waypoint</text></img>
<osd enabled="no" type="button" x="-96" y="-96" command="zoom_in()" src="zoom_in.png"/>
<osd enabled="no" type="button" x="0" y="-96" command="zoom_out()" src="zoom_out.png"/>
+ <!-- Traffic -->
+ <traffic type="null"/>
+
<!-- Vehicle with GPS enabled for gpsd on unix -->
<vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="gpsd://localhost" gpsd_query="w+xj">
<!-- Vehicle with GPS enabled for direct communication on windows. Remove the line above if you use this. -->
diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c
index 95324f324..99a4b4ffc 100644
--- a/navit/vehicle/gpsd/vehicle_gpsd.c
+++ b/navit/vehicle/gpsd/vehicle_gpsd.c
@@ -325,7 +325,11 @@ static void vehicle_gpsd_io(struct vehicle_priv *priv) {
int read_result;
/* Read until EOF, in case we are lagging behind.
* No point in processing old GPS reports. */
+#if GPSD_API_MAJOR_VERSION >= 7
+ while((read_result=gps_read(priv->gps, NULL, 0))>0);
+#else
while((read_result=gps_read(priv->gps))>0);
+#endif
if(read_result==-1) {
dbg(lvl_error,"gps_poll failed");
vehicle_gpsd_close(priv);
diff --git a/navit/xslt/android.xslt b/navit/xslt/android.xslt
index 412735273..3a1fdaf02 100644
--- a/navit/xslt/android.xslt
+++ b/navit/xslt/android.xslt
@@ -44,6 +44,9 @@
&lt;img src=''gui_rules'' onclick=''navit.graphics.set_map_location();''>&lt;text>Set map location&lt;/text>&lt;/img>
&lt;img src=''gui_rules'' onclick=''navit.graphics.backup_restore_dialog();''>&lt;text>Backup / Restore&lt;/text>&lt;/img>')"/>
</xsl:template>
+ <xsl:template match="/config/navit/traffic">
+ <traffic type="traff_android"/>
+ </xsl:template>
<xsl:template match="/config/navit[1]">
<xsl:copy>